multi channel select statements. All the code for the project is on
github, and here's the stack trace:
Consider two channels:
The allClosed channel indicates the "work" should be considered done
and is used to indicate this to some worker goroutine so that it
exits. No code tries to send to allClosed, it is only ever closed.
The worker goroutine (1) has a select statement as such:
return nil, ErrAlreadyClosed
case l.counter <- inc:
// do work
Another goroutine (2) triggers a close as such:
It seems goroutine (1) ends up hitting the select and finds that
allClosed isn't closed but counter is closed and panics with a "send
on closed channel".
It seems like it's possible for the two close statements to execute
between the time the select tries the first case and the second case.
My question is that is this expected and if so how does one deal with
I'm running this with tip from earlier today:
go version devel +bbe324079abe Tue May 07 11:41:36 2013 -0700 linux/amd64
Linux daaku.org 3.8.4-x86_64-linode31 #1 SMP Mon Mar 25 16:00:34 EDT
2013 x86_64 GNU/Linux
(Note: I *think* there may be a possible leak or missing timeout for
the stathat logic based on the number of other running goroutines that
I'm also looking into, but doesn't look related to this panic.)
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 email@example.com.
For more options, visit https://groups.google.com/groups/opt_out.