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

log/syslog: data race on done chan #4769

Closed
dvyukov opened this issue Feb 6, 2013 · 7 comments
Closed

log/syslog: data race on done chan #4769

dvyukov opened this issue Feb 6, 2013 · 7 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Feb 6, 2013

After https://golang.org/cl/6782140
race builder says:

WARNING: DATA RACE
Write by goroutine 33:
  runtime.closechan()
      /usr/local/go/src/pkg/runtime/chan.c:1178 +0x0
  log/syslog.TestConcurrentReconnect()
      /usr/local/go/src/pkg/log/syslog/syslog_test.go:317 +0x335
  testing.tRunner()
      /usr/local/go/src/pkg/testing/testing.go:314 +0xe8

Previous read by goroutine 54:
  runtime.chansend()
      /usr/local/go/src/pkg/runtime/chan.c:155 +0x0
  log/syslog.func·001()
      /usr/local/go/src/pkg/log/syslog/syslog_test.go:64 +0x120

Goroutine 33 (running) created at:
  testing.RunTests()
      /usr/local/go/src/pkg/testing/testing.go:429 +0xc7a
  testing.Main()
      /usr/local/go/src/pkg/testing/testing.go:326 +0xcd
  main.main()
      log/syslog/_test/_testmain.go:57 +0xda
  runtime.main()
      /usr/local/go/src/pkg/runtime/proc.c:255 +0x8e

Goroutine 54 (finished) created at:
  log/syslog.runStreamSyslog()
      /usr/local/go/src/pkg/log/syslog/syslog_test.go:67 +0x114

Looks like a race between chan send and close. Are they synchronized via syslog?
@jeffallen
Copy link
Contributor

Comment 1:

When working on that CL I saw this once, and tried to find a solution, but then forgot
about it. Looking at it again this morning, I see a better way to handle it. CL coming.

@davecheney
Copy link
Contributor

Comment 2:

https://golang.org/cl/7311052/

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

Status changed to Started.

@dvyukov
Copy link
Member Author

dvyukov commented Feb 8, 2013

Comment 3:

ThreadSanitizer hit it. This is what I've observed today w/o race detector:
panic: runtime error: send on closed channel
goroutine 12 [running]:
runtime.panic(0x5632f0, 0xc2000cf300)
    src/pkg/runtime/panic.c:245 +0xb1
runtime.panicstring(0x6777e0, 0x100000001)
    src/pkg/runtime/panic.c:496 +0xa3
runtime.chansend(0x4fd778, 0xc200038ba0, 0x7fe26214ef68, 0x0, 0x431f47, ...)
    src/pkg/runtime/chan.c:287 +0x12e
runtime.chansend1(0x4fd778, 0xc200038ba0, 0xc2000ac720, 0x50)
    src/pkg/runtime/chan.c:445 +0x4c
log/syslog.func·001(0xc200000470, 0xc200038300, 0xc2000008c0, 0x0)
    src/pkg/log/syslog/syslog_test.go:64 +0xd7
runtime.goexit()
    src/pkg/runtime/proc.c:823
created by log/syslog.runStreamSyslog
    src/pkg/log/syslog/syslog_test.go:67 +0x101

@adg
Copy link
Contributor

adg commented Feb 27, 2013

Comment 4:

Issue #4832 has been merged into this issue.

@adg
Copy link
Contributor

adg commented Feb 27, 2013

Comment 5:

Issue #4467 has been merged into this issue.

@adg
Copy link
Contributor

adg commented Feb 27, 2013

Comment 6:

Issue #4928 has been merged into this issue.

@remyoudompheng
Copy link
Contributor

Comment 7:

This issue was closed by revision 67d0445.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 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
Development

No branches or pull requests

7 participants