Commit 50586bc7 authored by Kirill Smelkov's avatar Kirill Smelkov

tracing/tracetest: There might be multiple pending sends on the same channel

This is possible if the system is incorrectly decomposed into serial
streams. We want to show all pending events in that case, not only the
first random one.
parent d6963bdf
...@@ -313,11 +313,21 @@ func (t *T) closeStreamTab() (nnak int) { ...@@ -313,11 +313,21 @@ func (t *T) closeStreamTab() (nnak int) {
for _, stream := range streams { for _, stream := range streams {
ch := streamTab[stream] ch := streamTab[stream]
quiet := true
// check whether someone is sending on channels without blocking. // check whether someone is sending on channels without blocking.
select { loop: // loop because there might be several concurrent pending sends to particular channel.
case msg := <-ch.msgq: for {
sendv = append(sendv, sendInfo{ch, msg}) select {
default: case msg := <-ch.msgq:
sendv = append(sendv, sendInfo{ch, msg})
quiet = false
default:
break loop
}
}
if quiet {
quietv = append(quietv, ch) quietv = append(quietv, ch)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment