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
net/http: racy use of timers in http2Transport #37449
With these strategically-placed sleeps:
I get reliable crashes out of
The crash is a detected race between s.timer.Reset during the request writing goroutine (specifically a delayed body write) and s.timer.Stop during response processing of a 100 Continue header. Full stacks below.
The code is correct except for provoking the race panic. The timer setup is:
The request writing does:
If we get a 100 Continue then we stop the timer and run the function:
where on100 is:
The Stop is cleanup, and fnonce is protecting the actual work.
If we don't remove the panic in #37400 then we need to rewrite this code.
If we see a racy use of timers, as in concurrent calls to Timer.Reset, do the operations in an unpredictable order, rather than crashing. Updates #37400 Updates #37449 Fixes #37494 Change-Id: Idbac295df2dfd551b6d762909d5040fc532c1b34 Reviewed-on: https://go-review.googlesource.com/c/go/+/221077 Run-TryBot: Ian Lance Taylor <firstname.lastname@example.org> TryBot-Result: Gobot Gobot <email@example.com> Reviewed-by: Michael Knyszek <firstname.lastname@example.org> (cherry picked from commit 98858c4) Reviewed-on: https://go-review.googlesource.com/c/go/+/221298