-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime/internal/wasitest: TestTCPEcho is racy #61820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The test also contains a hard-coded timeout of 2.5s, which should be eliminated: A heavily loaded CI machine may suffer arbitrarily long delays. In general, I find that it is best to just let the test loop until it times out, at which point it will dump the running goroutines for debugging. If that doesn't produce the right information to diagnose a failure, the next best option is to use |
@gopherbot, please backport to Go 1.21. This is a racy test, and a flaky failure was observed during the Go 1.21.0 release process. |
Backport issue(s) opened: #61821 (for 1.21). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Change https://go.dev/cl/519895 mentions this issue: |
Change https://go.dev/cl/520955 mentions this issue: |
… test The wasip1 TCP echo test introduced in CL 493358 has a race condition with port selection. The test runner probes for a free port and then asks the WASM runtime to listen on the port, which may be taken by another process in the interim. Due to limitations with WASI preview 1, the guest is unable to query the port it's listening on. The test cannot ask the WASM runtime to listen on port 0 (choose a free port) since there's currently no way for the test to query the selected port and connect to it. Given the race condition is unavoidable, this test is now disabled by default and requires opt-in via an environment variable. This commit also eliminates the hard-coded connection timeout. Updates #61820. Fixes #61821. Change-Id: I375145c1a1d03ad45c44f528da3347397e6dcb01 Reviewed-on: https://go-review.googlesource.com/c/go/+/519895 Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> (cherry picked from commit 795e779) Reviewed-on: https://go-review.googlesource.com/c/go/+/520955 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
TestTCPEcho
has a logical race condition: it opens a listener on a local TCP port, closes that port, and then assumes that the port is available for reuse (and not, say, taken by some other test process that is running concurrently):https://cs.opensource.google/go/go/+/master:src/runtime/internal/wasitest/tcpecho_test.go;l=33-38;drc=3687f77069a8f40a596be7bd848985990908f0d9
It should be rewritten to avoid that race if possible. If avoiding the race is impossible, the test should be skipped by default (and require an explicit flag or environment variable to be set in order to run).
(attn @golang/wasm @johanbrandhorst @chriso)
The text was updated successfully, but these errors were encountered: