FAQ
OS? Arch? Go version?

I assume linux-amd64 from coreos.com and -race. But which Go version?

I wonder if you're just generating lots of garbage and causing the GC to
run, making that time.After channel 10000 times.


On Wed, Jun 24, 2015 at 11:27 PM, Yicheng Qin wrote:

Hi all,

We observe at least 10ms delay before receiving message from closed
buffered channel. We met this when we run some code basically like this:

```
chs := make([]chan struct{}, 10000)
// init
for i := range chs {
chs[i] = make(chan struct{}, 1)
}
// close
for _, ch := range chs {
close(ch)
}
// receive
for _, ch := range chs {
select {
case <-ch:
case <-time.After(10 * time.Millisecond):
t.Fatalf("")
}
}
```

The test environment is under --cpu 4 --race on travis(2 bursted cpu) when
running `go test` for the whole test set. After I adjust the timeout to 1s,
I didn't observe this behavior anymore. Is this behavior expected?

I check the spec, which says that `After calling close, and after any
previously sent values have been received, receive operations will return
the zero value for the channel's type without blocking.`

--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 7 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJun 24, '15 at 9:27p
activeJun 25, '15 at 10:13p
posts7
users3
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase