<p dir="auto">by <strong><a href="mailto:raul.san@sent.com">raul.san@sent.com</a></strong>:</p>
<pre class="notranslate">Logger should have functions related to exit (Exit, Exitf, Exitln)

<a href="http://golang.org/pkg/log/#Logger" rel="nofollow">http://golang.org/pkg/log/#Logger</a></pre>
<pre class="notranslate">To reproduce:

while go test log/syslog; do echo ok; done

Eventually (after a few dozen iterations) you'll see a panic (trace is below).

Looks to be caused by TestConcurrentReconnect.

The weird part is that the panic is "send on closed channel", but by my
reading of the code any sends to the "done" channel must happen before the
channel is closed, because the call to close happens right after a waitgroup.Wait(), and
all the sends happen before the various calls to waitgroup.Done(). 

Why only on freebsd-386? Weird.

panic: runtime error: send on closed channel

goroutine 49 [running]:
log/syslog.func·001(0x38c5b280, 0x38cd8630)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:67 +0x151
created by log/syslog.runStreamSyslog
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:70 +0x131

goroutine 1 [chan receive]:
testing.RunTests(0x8163ac0, 0x8218d10, 0x8, 0x8, 0x1, ...)
    /home/gopher/go/src/pkg/testing/testing.go:427 +0x69c
testing.Main(0x8163ac0, 0x8218d10, 0x8, 0x8, 0x821ba00, ...)
    /home/gopher/go/src/pkg/testing/testing.go:358 +0x66
main.main()
    log/syslog/_test/_testmain.go:57 +0x7e

goroutine 0 [syscall]:

goroutine 34 [syscall]:
syscall.Syscall()
    /home/gopher/go/src/pkg/syscall/asm_freebsd_386.s:0 +0x5
syscall.Unlink(0x38cacdc0, 0x18, 0x0, 0x0)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x7d
os.Remove(0x38cacdc0, 0x18, 0x38cacd20, 0x18)
    /home/gopher/go/src/pkg/os/file_unix.go:235 +0x2e
log/syslog.TestConcurrentReconnect(0x38ca7c00)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:334 +0x267
testing.tRunner(0x38ca7c00, 0x8218d64)
    /home/gopher/go/src/pkg/testing/testing.go:346 +0x84
created by testing.RunTests
    /home/gopher/go/src/pkg/testing/testing.go:426 +0x681

goroutine 4 [syscall]:
syscall.Syscall6()
    /home/gopher/go/src/pkg/syscall/asm_freebsd_386.s:0 +0x5
syscall.kevent(0x6, 0x0, 0x0, 0x38c71004, 0xa, ...)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x66
syscall.Kevent(0x6, 0x0, 0x0, 0x0, 0x38c71004, ...)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x76
net.(*pollster).WaitFD(0x38c71000, 0x38c5a860, 0x1cc4e26, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/fd_bsd.go:98 +0x193
net.(*pollServer).Run(0x38c5a860)
    /home/gopher/go/src/pkg/net/fd_unix.go:212 +0x135
created by net.newPollServer
    /home/gopher/go/src/pkg/net/newpollserver_unix.go:33 +0x266

goroutine 5 [chan receive]:
net.(*pollServer).WaitRead(0x38c5a860, 0x38c5c100, 0x38c5a900, 0x23)
    /home/gopher/go/src/pkg/net/fd_unix.go:244 +0x5a
net.(*netFD).accept(0x38c5c100, 0x8163b40, 0x0, 0x38c5a900, 0x23, ...)
    /home/gopher/go/src/pkg/net/fd_unix.go:631 +0x11e
net.(*UnixListener).AcceptUnix(0x38c6c130, 0x80719d1, 0x58c11f88, 0x80719d1)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:282 +0x3f
net.(*UnixListener).Accept(0x38c6c130, 0x0, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:293 +0x46
log/syslog.runStreamSyslog(0x38c5a940, 0x38c6c130, 0x38c57420, 0x38c5a800)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:53 +0x5e
created by log/syslog.startServer
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:109 +0x3dc

goroutine 9 [chan receive]:
net.(*pollServer).WaitRead(0x38c5a860, 0x38c9d480, 0x38c5a900, 0x23)
    /home/gopher/go/src/pkg/net/fd_unix.go:244 +0x5a
net.(*netFD).accept(0x38c9d480, 0x8163b30, 0x0, 0x38c5a900, 0x23, ...)
    /home/gopher/go/src/pkg/net/fd_unix.go:631 +0x11e
net.(*TCPListener).AcceptTCP(0x38c06a60, 0x80719d1, 0x0, 0x0)
    /home/gopher/go/src/pkg/net/tcpsock_posix.go:232 +0x4f
net.(*TCPListener).Accept(0x38c06a60, 0x0, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/tcpsock_posix.go:242 +0x46
log/syslog.runStreamSyslog(0x38c9a7a0, 0x38c06a60, 0x38c577b0, 0x38c9a6a0)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:53 +0x5e
created by log/syslog.startServer
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:109 +0x3dc

goroutine 12 [chan receive]:
net.(*pollServer).WaitRead(0x38c5a860, 0x38c9d580, 0x38c5a900, 0x23)
    /home/gopher/go/src/pkg/net/fd_unix.go:244 +0x5a
net.(*netFD).accept(0x38c9d580, 0x8163b40, 0x0, 0x38c5a900, 0x23, ...)
    /home/gopher/go/src/pkg/net/fd_unix.go:631 +0x11e
net.(*UnixListener).AcceptUnix(0x38c6c5c0, 0x80719d1, 0x58d25f88, 0x80719d1)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:282 +0x3f
net.(*UnixListener).Accept(0x38c6c5c0, 0x0, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:293 +0x46
log/syslog.runStreamSyslog(0x38c5a940, 0x38c6c5c0, 0x38c57840, 0x38c9a920)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:53 +0x5e
created by log/syslog.startServer
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:109 +0x3dc

goroutine 23 [chan receive]:
net.(*pollServer).WaitRead(0x38c5a860, 0x38c9df80, 0x38c5a900, 0x23)
    /home/gopher/go/src/pkg/net/fd_unix.go:244 +0x5a
net.(*netFD).ReadFrom(0x38c9df80, 0x38cb1000, 0x1000, 0x1000, 0x0, ...)
    /home/gopher/go/src/pkg/net/fd_unix.go:471 +0x296
net.(*UDPConn).ReadFromUDP(0x38cae290, 0x38cb1000, 0x1000, 0x1000, 0x80d7b0e, ...)
    /home/gopher/go/src/pkg/net/udpsock_posix.go:72 +0xc7
net.(*UDPConn).ReadFrom(0x38cae290, 0x38cb1000, 0x1000, 0x1000, 0x821c0a8, ...)
    /home/gopher/go/src/pkg/net/udpsock_posix.go:87 +0xb4
log/syslog.runPktSyslog(0x38c57750, 0x38cae290, 0x38c57a80)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:31 +0x102
log/syslog.func·002()
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:101 +0x5b
created by log/syslog.startServer
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:102 +0x271

goroutine 14 [chan receive]:
net.(*pollServer).WaitRead(0x38c5a860, 0x38ca8080, 0x38c5a900, 0x23)
    /home/gopher/go/src/pkg/net/fd_unix.go:244 +0x5a
net.(*netFD).accept(0x38ca8080, 0x8163b40, 0x0, 0x38c5a900, 0x23, ...)
    /home/gopher/go/src/pkg/net/fd_unix.go:631 +0x11e
net.(*UnixListener).AcceptUnix(0x38c6c630, 0x813275c, 0x1, 0x1)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:282 +0x3f
net.(*UnixListener).Accept(0x38c6c630, 0x0, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:293 +0x46
log/syslog.runStreamSyslog(0x38c5a940, 0x38c6c630, 0x38c57840, 0x38c9ac60)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:53 +0x5e
created by log/syslog.startServer
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:109 +0x3dc

goroutine 50 [runnable]:
syscall.Syscall()
    /home/gopher/go/src/pkg/syscall/asm_freebsd_386.s:0 +0x48
syscall.Close(0xf, 0x0, 0x0)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x4e
os.(*file).close(0x38c5af60, 0x0, 0x0)
    /home/gopher/go/src/pkg/os/file_unix.go:107 +0x4d

goroutine 48 [runnable]:
syscall.Syscall()
    /home/gopher/go/src/pkg/syscall/asm_freebsd_386.s:0 +0x48
syscall.read(0x1b, 0x38ce5000, 0x1000, 0x1000, 0xe, ...)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x58
syscall.Read(0x1b, 0x38ce5000, 0x1000, 0x1000, 0x12c, ...)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x4e
net.(*netFD).Read(0x38ca8200, 0x38ce5000, 0x1000, 0x1000, 0x0, ...)
    /home/gopher/go/src/pkg/net/fd_unix.go:437 +0x1dd
net.(*conn).Read(0x38cd8610, 0x38ce5000, 0x1000, 0x1000, 0x8050f2e, ...)
    /home/gopher/go/src/pkg/net/net.go:123 +0xa6
created by log/syslog.runStreamSyslog
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:70 +0x131

goroutine 35 [runnable]:
syscall.Syscall()
    /home/gopher/go/src/pkg/syscall/asm_freebsd_386.s:0 +0x48
syscall.accept(0x10, 0x38ce6000, 0x38cae000, 0x1, 0x0, ...)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x4e
syscall.Accept(0x10, 0x38c8e780, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/syscall/bpf_bsd.go:0 +0x7c
net.accept(0x10, 0x38c5a800, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/sys_cloexec.go:42 +0x26
net.(*netFD).accept(0x38c8e780, 0x8163b40, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/fd_unix.go:628 +0x91
net.(*UnixListener).AcceptUnix(0x38c6c3c0, 0x80719d1, 0x58d1af88, 0x80719d1)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:282 +0x3f
net.(*UnixListener).Accept(0x38c6c3c0, 0x0, 0x0, 0x0, 0x0, ...)
    /home/gopher/go/src/pkg/net/unixsock_posix.go:293 +0x46
log/syslog.runStreamSyslog(0x38c5a940, 0x38c6c3c0, 0x38c57cc0, 0x38cacda0)
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:53 +0x5e
created by log/syslog.startServer
    /home/gopher/go/src/pkg/log/syslog/syslog_test.go:109 +0x3dc
FAIL    log/syslog  2.320s</pre>