Skip to content

Commit

Permalink
[release-branch.go1.18] misc/cgo/testsanitizers: use buffered channel…
Browse files Browse the repository at this point in the history
… in tsan12.go

os/signal.Notify requires that "the caller must ensure that c has
sufficient buffer space to keep up with the expected signal rate"
as it does a nonblocking send when it receives a signal. The test
currently using a unbuffered channel, which means it may miss the
signal if the signal arrives before the channel receive operation.

Fixes #53043.
Updates #52998.

Change-Id: Icdcab9396d735506480ef880fb45a4669fa7cc8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/407888
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 62e1302)
Reviewed-on: https://go-review.googlesource.com/c/go/+/408114
  • Loading branch information
cherrymui authored and toothrot committed May 25, 2022
1 parent cf5fa2b commit 04337a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion misc/cgo/testsanitizers/testdata/tsan12.go
Expand Up @@ -22,7 +22,7 @@ import (
import "C"

func main() {
ch := make(chan os.Signal)
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGUSR1)

if err := exec.Command("true").Run(); err != nil {
Expand Down

0 comments on commit 04337a6

Please sign in to comment.