FAQ
Hello-

tl;dr Go's Sendmsg always sends a "dummy byte" even when you are only
sending OOB data. This breaks a protocol I want to talk to:
systemd-journal. See attached patch for a "fix".

While working on go-systemd[1] David found that Go syscall.Sendmsg was
always sending one byte of data when we only wanted to send out of
band data (a file descriptor). The attached patch "fixes" the problem
for us but also breaks the tests.

This is the line of code in systemd-journal that rejects messages with
the dummy byte:
https://github.com/systemd/systemd/blob/master/src/journal/journald-server.c#L1238

Instead of fixing everything up I wanted to understand _why_ this
dummy byte is being sent first. The code seems to have been there
since the initial commit of the syscall_linux.go.

So, why was does this dummy byte exist? Are there other platforms that
require this byte?

If I fixup all of the tests and the poller is this patch mergeable?

Thank You,

Brandon

[1] https://github.com/coreos/go-systemd/blob/master/journal/send.go#L83

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Mikio Hara at Sep 20, 2013 at 11:49 pm

    On Sat, Sep 21, 2013 at 5:50 AM, Brandon Philips wrote:

    Instead of fixing everything up I wanted to understand _why_ this
    dummy byte is being sent first.
    https://codereview.appspot.com/2331044#msg12
    Hm, interesting.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Brandon Philips at Sep 20, 2013 at 11:59 pm
    Hello Albert-

    Could you explain why the 1 byte dummy is needed? It seems you wrote the code :)

    https://codereview.appspot.com/2331044/#ps28001

    Thanks!

    Brandon
    On Fri, Sep 20, 2013 at 3:50 PM, Brandon Philips wrote:
    Hello-

    tl;dr Go's Sendmsg always sends a "dummy byte" even when you are only
    sending OOB data. This breaks a protocol I want to talk to:
    systemd-journal. See attached patch for a "fix".

    While working on go-systemd[1] David found that Go syscall.Sendmsg was
    always sending one byte of data when we only wanted to send out of
    band data (a file descriptor). The attached patch "fixes" the problem
    for us but also breaks the tests.

    This is the line of code in systemd-journal that rejects messages with
    the dummy byte:
    https://github.com/systemd/systemd/blob/master/src/journal/journald-server.c#L1238

    Instead of fixing everything up I wanted to understand _why_ this
    dummy byte is being sent first. The code seems to have been there
    since the initial commit of the syscall_linux.go.

    So, why was does this dummy byte exist? Are there other platforms that
    require this byte?

    If I fixup all of the tests and the poller is this patch mergeable?

    Thank You,

    Brandon

    [1] https://github.com/coreos/go-systemd/blob/master/journal/send.go#L83
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Albert Strasheim at Sep 22, 2013 at 11:36 pm
    Hello

    Sorry, I was away for a bit.
    On Sat, Sep 21, 2013 at 1:59 AM, Brandon Philips wrote:
    Hello Albert-
    Could you explain why the 1 byte dummy is needed? It seems you wrote the code :)
    https://codereview.appspot.com/2331044/#ps28001
    I'm having to dig into deep swap here. :-)

    Initial discussion with agl on this topic:

    https://groups.google.com/d/topic/golang-dev/Rkwgwug2OpI/discussion

    The code review you linked has most of the followup discussion:

    https://codereview.appspot.com/2331044/

    which linked to:

    http://svn.python.org/projects/python/branches/py3k/Modules/_multiprocessing/multiprocessing.c

    which had the same dummy byte, to which rsc said:

    "Yes, that's what everyone resorts to. Sigh."

    So it seems there are some conditions under which it simply doesn't
    work without the dummy byte. I'll need to write some tests to remember
    exactly what they were. I'll report back once I have some time to
    remember more. Hopefully tomorrow.

    Regards

    Albert

    P.S. I love that Go, CoreOS and systemd are starting to play together.
    Very exciting.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 20, '13 at 8:50p
activeSep 22, '13 at 11:36p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase