Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime: trim unnecessary fields from scase #40410
I think this can be trimmed down to just 2:
It looks like per-scase releasetime is intended to help when the select is awoken because of a channel closing. However, it turns out this code has corner cases that would be addressed by replacing it with a single
However, there's no guarantee that the re-poll will actually pick the same case that triggered the wakeup. It's possible that between the channel close wakeup and the goroutine getting to run, other cases might become ready too. If one of these other cases ends up getting selected on the re-poll, we'll never end up recording a block event.
As an extreme but somewhat contrived example (involving selecting on the same channel twice), this program spends a total of 1 second blocked waiting for the
The more realistic example, this program also spends 1 second blocked waiting for the
Uploaded a WIP patch series that implements this.
The change to separate the
Easy fix is probably to create and populate the
Some notes to self on more cleanup still to do: