summaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/net/http2/gotrack.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-09-17 14:48:09 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-09-17 14:48:09 +0200
commite81bcb51717aa318b02996b846b3fe8cc733af18 (patch)
treeaf43449e79d6d607669b78ce5b5ced1fd7acb04c /vendor/golang.org/x/net/http2/gotrack.go
parent[chore] remove nollamas middleware for now (after discussions with a security... (diff)
downloadgotosocial-e81bcb51717aa318b02996b846b3fe8cc733af18.tar.xz
[chore] update dependencies (#4441)
- modernc.org/sqlite v1.38.2 -> v1.39.0 (w/ concurrency workaround) - golang.org/x/net v0.43.0 -> v0.44.0 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4441 Reviewed-by: tobi <kipvandenbos@noreply.codeberg.org> Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/golang.org/x/net/http2/gotrack.go')
-rw-r--r--vendor/golang.org/x/net/http2/gotrack.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/vendor/golang.org/x/net/http2/gotrack.go b/vendor/golang.org/x/net/http2/gotrack.go
index 9933c9f8c..9921ca096 100644
--- a/vendor/golang.org/x/net/http2/gotrack.go
+++ b/vendor/golang.org/x/net/http2/gotrack.go
@@ -15,21 +15,32 @@ import (
"runtime"
"strconv"
"sync"
+ "sync/atomic"
)
var DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1"
+// Setting DebugGoroutines to false during a test to disable goroutine debugging
+// results in race detector complaints when a test leaves goroutines running before
+// returning. Tests shouldn't do this, of course, but when they do it generally shows
+// up as infrequent, hard-to-debug flakes. (See #66519.)
+//
+// Disable goroutine debugging during individual tests with an atomic bool.
+// (Note that it's safe to enable/disable debugging mid-test, so the actual race condition
+// here is harmless.)
+var disableDebugGoroutines atomic.Bool
+
type goroutineLock uint64
func newGoroutineLock() goroutineLock {
- if !DebugGoroutines {
+ if !DebugGoroutines || disableDebugGoroutines.Load() {
return 0
}
return goroutineLock(curGoroutineID())
}
func (g goroutineLock) check() {
- if !DebugGoroutines {
+ if !DebugGoroutines || disableDebugGoroutines.Load() {
return
}
if curGoroutineID() != uint64(g) {
@@ -38,7 +49,7 @@ func (g goroutineLock) check() {
}
func (g goroutineLock) checkNotOn() {
- if !DebugGoroutines {
+ if !DebugGoroutines || disableDebugGoroutines.Load() {
return
}
if curGoroutineID() == uint64(g) {