Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall: problem with unix domain sockets under NetBSD-6.99.x #6627

Closed
bsiegert opened this issue Oct 20, 2013 · 9 comments
Closed

syscall: problem with unix domain sockets under NetBSD-6.99.x #6627

bsiegert opened this issue Oct 20, 2013 · 9 comments

Comments

@bsiegert
Copy link
Contributor

@bsiegert bsiegert commented Oct 20, 2013

A user reported this problem in the pkgsrc/lang/go package (which is on the 1.1 branch)
as well as in pkgsrc-wip/go (1.2rc1). I can also reproduce it with tip and the latest
NetBSD-current (6.99.24), running under VMware Fusion on my Mac.

The following tests fail during the build:

--- FAIL: TestWithSimulated (0.00 seconds)
        syslog_test.go:133: Dial() failed: dial unix /tmp/syslogtest63953102: no such file or directory
--- FAIL: TestFlap (0.00 seconds)
        syslog_test.go:154: Dial() failed: dial unix /tmp/syslogtest83137442: no such file or directory
--- FAIL: TestConcurrentReconnect (0.00 seconds)
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
        syslog_test.go:336: syslog.Dial() failed: dial unix /tmp/syslogtest97447980: no such file or directory
FAIL
FAIL    log/syslog      1.414s

--- FAIL: TestConnAndListener (0.00 seconds)
        conn_test.go:63: Dial failed: dial unix /tmp/nettest96083477: no such file or directory
        conn_test.go:95: Listener.Accept failed: use of closed network connection
--- FAIL: TestShutdownUnix (0.00 seconds)
        net_test.go:87: Accept: accept unix /tmp/go_net_unixtest03654613: invalid argument
        net_test.go:111: client Read: 0, EOF
--- FAIL: TestPacketConn (0.00 seconds)
        packetconn_test.go:31: skipping test; must be root
        packetconn_test.go:113: PacketConn.WriteTo failed: write unixgram: no such file or directory
--- FAIL: TestConnAndPacketConn (0.00 seconds)
        packetconn_test.go:31: skipping test; must be root
        packetconn_test.go:161: Dial failed: dial unixgram /tmp/nettest58061351: no such file or directory
--- FAIL: TestStreamConnServer (0.00 seconds)
        server_test.go:218: Dial("unix", "/tmp/gotest1.net.89") failed: dial unix /tmp/gotest1.net.89: no such file or directory
--- FAIL: TestReadUnixgramWithUnnamedSocket (0.01 seconds)
        unix_test.go:56: UnixConn.ReadFrom failed: read unixgram /tmp/nettest48217720: invalid argument
--- FAIL: TestReadUnixgramWithZeroBytesBuffer (0.00 seconds)
        unix_test.go:103: UnixConn.ReadFrom failed: read unixgram /tmp/nettest77742704: invalid argument
--- FAIL: TestUnixConnLocalAndRemoteNames (0.00 seconds)
        unix_test.go:202: got &net.UnixAddr{Name:"/tmp/nettest27526054", Net:"unix"}, expected &net.UnixAddr{Name:"/tmp/nettest275260547", Net:"unix"}
        conn_test.go:95: Listener.Accept failed: use of closed network connection
--- FAIL: TestUnixgramConnLocalAndRemoteNames (0.00 seconds)
        unix_test.go:255: got &net.UnixAddr{Name:"/tmp/nettest35841834", Net:"unixgram"}, expected &net.UnixAddr{Name:"/tmp/nettest358418349", Net:"unixgram"}
FAIL
FAIL    net     7.933s

*** Test killed: ran too long (3m0s).
FAIL    os/signal       185.066s

--- FAIL: TestPassFD (0.00 seconds)
        passfd_test.go:62: child process: "failed to find unix fd\n", <nil>
FAIL
FAIL    syscall 0.008s
@bsiegert
Copy link
Contributor Author

@bsiegert bsiegert commented Oct 20, 2013

Comment 1:

$ uname -a
NetBSD netlem.mirbsd.org 6.99.24 NetBSD 6.99.24 (GENERIC) #0: Sun Oct 20 03:37:33 UTC
2013 
builds@b8.netbsd.org:/home/builds/ab/HEAD/amd64/201310200220Z-obj/home/builds/ab/HEAD/src/sys/arch/amd64/compile/GENERIC
amd64
$ hg identify
69bf31787310 tip
@mikioh
Copy link
Contributor

@mikioh mikioh commented Oct 21, 2013

Comment 2:

Hi,
Do you have a spare time to dig up the root cause of this issue? Pretty interesting that:
>  got &net.UnixAddr{Name:"/tmp/nettest27526054", Net:"unix"}, expected
&net.UnixAddr{Name:"/tmp/nettest275260547", Net:"unix"}
> got &net.UnixAddr{Name:"/tmp/nettest35841834", Net:"unixgram"}, expected
&net.UnixAddr{Name:"/tmp/nettest358418349"
funny, the last char of filepath was eaten by Bogeyman?
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 21, 2013

Comment 3 by tk@giga.or.at:

For Unix sockets, Linux sets sock_addrlen to the strlen(sun_path)+1 to include the
trailing zero, while NetBSD sets it to strlen(sun_path). That sounds like it could
probably cause this difference, doesn't it?
@mikioh
Copy link
Contributor

@mikioh mikioh commented Oct 22, 2013

Comment 4:

Maybe
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/uipc_usrreq.c.diff?r1=1.145&r2=1.146&only_with_tag=MAIN&f=h
If so, we need to have a separate RawSockaddrUnix handler for NetBSD 7.x (NetBSD-6.99.x)
in the near future.

Labels changed: added go1.3maybe, removed priority-triage.

@bsiegert
Copy link
Contributor Author

@bsiegert bsiegert commented Nov 18, 2013

Comment 5:

Looking at it in ktrace, the following happens:
 18022      1 unixtest CALL  bind(3,0xc21004a090,0x11)
 18022      1 unixtest MISC  mbsoname: [/tmp/unixtest]
 18022      1 unixtest NAMI  "/tmp/unixtest"
 18022      1 unixtest RET   bind 0
 18022      1 unixtest CALL  listen(3,0x80)
 18022      1 unixtest RET   listen 0
 18022      1 unixtest CALL  getsockname(3,0xc21004c070,0xc210000090)
 18022      1 unixtest MISC  mbsoname: [/tmp/unixtest]
 18022      1 unixtest RET   getsockname 0
 18022      1 unixtest GIO   fd 2 wrote 49 bytes
       "2013/11/18 12:43:35 Listening; addr=/tmp/unixtes\n"
So the truncation happens when reading the output of getsockname.
@bsiegert
Copy link
Contributor Author

@bsiegert bsiegert commented Nov 19, 2013

Comment 6:

https://golang.org/cl/28300043/ fixes the off-by-one in Getsockname but there
is more to it than that. If you apply it, UnixListener.Accept returns "invalid argument".
https://gist.github.com/bsiegert/7527628 is my simple test program.
@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 7:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

@rsc rsc commented Dec 4, 2013

Comment 8:

Labels changed: added repo-main.

@4a6f656c
Copy link
Contributor

@4a6f656c 4a6f656c commented Jan 3, 2014

Comment 9:

This issue was closed by revision d180579.

Status changed to Fixed.

@bsiegert bsiegert added fixed labels Jan 3, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.