-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Flaky test: test_pthread_proxying_cpp #18353
Comments
Thanks, taking a look now. |
Interesting, so assuming this is related to these linked issues, it also affects Node.js and the new proxying API. Perhaps we could experiment with removing those |
@kleisauke Interesting catch. It started failing pretty suddenly and pretty frequently, so a recent change being a culprit seems likely. |
FWIW, issue #16136 was the first one that reported this flaky behavior, a couple months after that commit was landed. At the time, I thought it only affected the browser tests (unfortunately, all those CI logs disappeared due to the retention time on CircleCI). |
Given these tests started to fail more frequently, it could also be related to commit a37b4b2 and/or the current I once had a idea to do this during compile-time, see for e.g. commit 27c2a3a. However, I abandoned it because that could lead to redundant file locking if no pthreads are running. Although in retrospect, I think this could resolve a similar issue in the Wasm Workers API (which I reproduced in PR #18201). |
... let me know if help is needed with testing/implementation. Note that the above assumptions were made for triage purposes (and given that race conditions/deadlocks are generally difficult to debug). |
I assume that this is due to my change to this test a few days ago (#18350), and not anything to do with musl or other system libraries. |
Whew, I started worrying this is due to my recent changes to Node.js pthreads. |
BTW a good way to avoid the C stdio subsystem completely in such tests its to use |
The tests in test_pthread_proxying_cpp proxy functions that increment local variables. For the async proxying functions, the proxying is followed by a wait on a condition variable so the test can assert that the proxied work was completed. However, the incrementing of the local variables was not protected by the lock used with the condition variable, so it was possible for the variable to be incremented and the condition variable notified after checking the wait condition but before waiting. Since the condition variable would not be notified again, the test would wait on the condition variable forever. Fix the bug by taking the lock before incrementing the variable in tests where this could cause problems. Fixes #18353.
The tests in test_pthread_proxying_cpp proxy functions that increment local variables. For the async proxying functions, the proxying is followed by a wait on a condition variable so the test can assert that the proxied work was completed. However, the incrementing of the local variables was not protected by the lock used with the condition variable, so it was possible for the variable to be incremented and the condition variable notified after checking the wait condition but before waiting. Since the condition variable would not be notified again, the test would wait on the condition variable forever. Fix the bug by taking the lock before incrementing the variable in tests where this could cause problems. Fixes #18353.
Looks like test_pthread_proxying_cpp is flaky on the CI too, probably similar to #18307 / #18314.
The text was updated successfully, but these errors were encountered: