Skip to content

test_pthread_proxying is flaky #25026

Closed

Description

@juj

This failure comes through every now and then:

======================================================================
FAIL: test_pthread_proxying (test_core.core0.test_pthread_proxying)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.12/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib/python3.12/unittest/case.py", line 634, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.12/unittest/case.py", line 589, in _callTestMethod
    if method() is not None:
       ^^^^^^^^
  File "/home/clb/buildbot/h12dsi-linux-mint22/emscripten_linux_x64/build/emscripten/main/test/common.py", line 928, in resulting_test
    return func(self, *args)
           ^^^^^^^^^^^^^^^^^
  File "/home/clb/buildbot/h12dsi-linux-mint22/emscripten_linux_x64/build/emscripten/main/test/common.py", line 385, in decorated
    f(self, *args, **kwargs)
  File "/home/clb/buildbot/h12dsi-linux-mint22/emscripten_linux_x64/build/emscripten/main/test/common.py", line 700, in metafunc
    f(self, *args, **kwargs)
  File "/home/clb/buildbot/h12dsi-linux-mint22/emscripten_linux_x64/build/emscripten/main/test/test_core.py", line 2606, in test_pthread_proxying
    self.do_run_in_out_file_test('pthread/test_pthread_proxying.c', interleaved_output=False)
  File "/home/clb/buildbot/h12dsi-linux-mint22/emscripten_linux_x64/build/emscripten/main/test/common.py", line 1980, in do_run_in_out_file_test
    output = self._build_and_run(srcfile, expected, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/clb/buildbot/h12dsi-linux-mint22/emscripten_linux_x64/build/emscripten/main/test/common.py", line 2029, in _build_and_run
    self.assertContained(o, js_output, regex=regex)
  File "/home/clb/buildbot/h12dsi-linux-mint22/emscripten_linux_x64/build/emscripten/main/test/common.py", line 1687, in assertContained
    self.fail("Expected to find '%s' in '%s', diff:\n\n%s\n%s" % (
  File "/usr/lib/python3.12/unittest/case.py", line 715, in fail
    raise self.failureException(msg)
AssertionError: Expected to find 'Testing async proxying
running widget 1 on main
running widget 2 on looper
running widget 3 on returner
Testing sync proxying
running widget 4 on looper
running widget 5 on returner
Testing sync_with_ctx proxying
running widget 6 on looper
running widget 7 on returner
Testing callback proxying
running widget 8 on main
running widget 9 on looper
running widget 10 on returner
Testing callback_with_ctx proxying
running widget 11 on main
running widget 12 on looper
running widget 13 on returner
Testing promise proxying
running widget 14 on worker
running widget 15 on looper
running widget 16 on returner
Testing promise_with_ctx proxying
running widget 17 on worker
running widget 18 on looper
running widget 19 on returner
Testing tasks queue growth
Testing proxying queue growth
work
work
work
work
done
' in 'Testing async proxying
running widget 1 on main
running widget 2 on looper
running widget 3 on returner
Testing sync proxying
running widget 4 on looper
running widget 5 on returner
Testing sync_with_ctx proxying
running widget 6 on looper
running widget 7 on returner
Testing callback proxying
running widget 8 on main
running widget 9 on looper
running widget 10 on returner
Testing callback_with_ctx proxying
running widget 11 on main
running widget 12 on looper
running widget 13 on returner
Testing promise proxying
running widget 14 on worker
running widget 15 on looper
running widget 16 on returner
Testing promise_with_ctx proxying
running widget 17 on unknown
running widget 18 on looper
running widget 19 on returner
Testing tasks queue growth
Testing proxying queue growth
work
work
work
work
done
looper_main
returner_main
quitting looper
returner_main
returner_main
program exited (with status: 0), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)
', diff:

--- expected
+++ actual
@@ -21,7 +21,7 @@
 running widget 15 on looper
 running widget 16 on returner
 Testing promise_with_ctx proxying
-running widget 17 on worker
+running widget 17 on unknown
 running widget 18 on looper
 running widget 19 on returner
 Testing tasks queue growth
@@ -31,4 +31,10 @@
 work
 work
 done
+looper_main
+returner_main
+quitting looper
+returner_main
+returner_main
+program exited (with status: 0), but keepRuntimeAlive() is set (counter=0) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)

which suggests some kind of a race condition in proxying. (a lot of other pthread proxying tests are already marked flaky)

Activity

  1. sbc100 commented on Aug 25, 2025

    @sbc100
    Collaborator
  2. tlively commented on Aug 26, 2025

    @tlively
    Member

    @brendandahl, would you be able to take a look at this?

  3. brendandahl commented on Aug 26, 2025

    @brendandahl
    Collaborator

    I haven't had any luck reproducing locally. I tried running on repeat and forcing single core.

  4. juj commented on Aug 27, 2025

    @juj
    CollaboratorAuthor

    Pushed a PR #25066 that adds new test test_stress_pthread_proxying, which reproduces the issue on my Linux box with ~70% rate - though on Windows PC it never reproduces.

  5. RAIHERE commented on Aug 30, 2025

    @RAIHERE
  6. RAIHERE commented on Aug 30, 2025

    @RAIHERE
  7. sbc100 commented on Sep 3, 2025

    @sbc100
    Collaborator

    I can't seem to get test_stress_pthread_proxying to fail on my machine. I ran it 7 times (after uncommenting the skip line).

    BTW, I'm not sure the parallel_stress_test_js_file mechanism is viable when its part of a full test suite like test_core which is already running in in parallel trying to saturate all the cores/

  8. juj commented on Sep 3, 2025

    @juj
    CollaboratorAuthor

    test_core which is already running in in parallel

    Err hmm, that is very true, I didn't even think about that.. Maybe these tests should go in a own suite stress for this.

  9. sbc100 commented on Sep 3, 2025

    @sbc100
    Collaborator

    I also cannot main core2.test_stress_proxy_to_pthread_hello_world fail on my linux machine.

  10. sbc100 commented on Sep 3, 2025

    @sbc100
    Collaborator

    Ah, I have to revert #25073 to make test_stress_proxy_to_pthread_hello_world fail.

  11. juj commented on Sep 7, 2025

    @juj
    CollaboratorAuthor

    BTW, I'm not sure the parallel_stress_test_js_file mechanism is viable when its part of a full test suite like test_core which is already running in in parallel trying to saturate all the cores/

    I don't think there is any reason to saturate the cores with the stress test, just saturating with any work will do. That shouldn't reduce the viability.

  12. added 3 commits that reference this issue on Sep 7, 2025
    a928dbc
    8cd7bc2
    d9e3154
  13. juj commented on Sep 7, 2025

    @juj
    CollaboratorAuthor

    Fix in #25209. Fortunately turned out to be simple.

  14. added a commit that references this issue on Sep 9, 2025
    b051e2c
  15. added a commit that references this issue on Sep 9, 2025
    fc02a77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions