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

Read len on a closed channel in a go routine is a Data Race #27776

Closed
NBR41 opened this issue Sep 20, 2018 · 1 comment
Closed

Read len on a closed channel in a go routine is a Data Race #27776

NBR41 opened this issue Sep 20, 2018 · 1 comment

Comments

@NBR41
Copy link

NBR41 commented Sep 20, 2018

What version of Go are you using (go version)?

go1.11

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="linux"

What did you do?

With this code :
https://play.golang.org/p/CjxvLH6cHut

What did you expect to see?

As in the go1.10, no race detected.

What did you see instead?

A race is detected :

==================
WARNING: DATA RACE
Write at 0x00c0000a8000 by goroutine 7:
  runtime.closechan()
      /home/prod/go1.11/src/runtime/chan.go:327 +0x0
  main.main.func2()
      /tmp/test.go:23 +0x79

Previous read at 0x00c0000a8000 by goroutine 6:
  main.main.func1()
      /tmp/test.go:13 +0xbe

Goroutine 7 (running) created at:
  main.main()
      /tmp/test.go:18 +0x8b

Goroutine 6 (running) created at:
  main.main()
      /tmp/test.go:11 +0x69
==================
@randall77
Copy link
Contributor

Dup of #27070

@golang golang locked and limited conversation to collaborators Sep 20, 2019
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

3 participants