Skip to content

testing/synctest,runtime: randomize scheduling to protect against Hyrum's Lawย #73850

Closed
@aclements

Description

@aclements

The new synctest package makes time deterministic within a testing bubble. One consequence of this is that the goroutine schedule also becomes more deterministic within the bubble. But it's a fragile determinism that depends on the scheduler implementation. If we leave this alone, Hyrum's Law will lead to tests that depend on the details of the scheduler implementation, making the scheduler more difficult to change in the future. We've successfully defended against this before through intentional randomization, most notably in map iteration and the select poll order. We should do the same for synctest and defend against Hyrum's Law by introducing intentional randomization in the selection of which runnable goroutine to run when inside a bubble. We already do this in -race mode and can probably reuse that same mechanism.

cc @neild , @golang/runtime

Metadata

Metadata

Assignees

Labels

ImplementationIssues describing a semantics-preserving change to the Go implementation.NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.okay-after-rc1Used by release team to mark a release-blocker issue as okay to resolve either before or after rc1release-blocker

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions