Skip to content

wasm2js1.test_pthread_c11_threads is showing flakiness #14579

Description

@sbc100
======================================================================
FAIL: test_pthread_c11_threads (test_core.wasm2js1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.6/unittest/case.py", line 605, in run
    testMethod()
  File "/root/project/tests/common.py", line 193, in decorated
    f(self)
  File "/root/project/tests/test_core.py", line 8246, in test_pthread_c11_threads
    self.do_run_in_out_file_test('pthread/test_pthread_c11_threads.c')
  File "/root/project/tests/common.py", line 1004, in do_run_in_out_file_test
    self._build_and_run(srcfile, expected, **kwargs)
  File "/root/project/tests/common.py", line 1055, in _build_and_run
    self.assertContained(expected_output, js_output)
  File "/root/project/tests/common.py", line 731, in assertContained
    additional_info
  File "/usr/lib/python3.6/unittest/case.py", line 670, in fail
    raise self.failureException(msg)
AssertionError: Expected to find 'done!
' in 'thrd_current: 0xa01b00
in thread_main 0xc02018
in do_oncemain 0xc02018in thread_main 0xe02330in thread_main 
in do_once
in do_oncemain 0xc02018in thread_main 0xe02330in thread_main 0x1202940
done thread_main
done thread_main
done thread_main
destructor: 0xc02018
destructor: 0xc02018destructor: 0xe02330
destructor: 0x1202940
in thread_main 0x1002628
done thread_main
destructor: 0x1002628
in thread_main 0xc02018
in th
', diff:

--- expected
+++ actual
@@ -1,2 +1,17 @@
-done!
+thrd_current: 0xa01b00
+in thread_main 0xc02018
+in do_oncemain 0xc02018in thread_main 0xe02330in thread_main
+in do_once
+in do_oncemain 0xc02018in thread_main 0xe02330in thread_main 0x1202940
+done thread_main
+done thread_main
+done thread_main
+destructor: 0xc02018
+destructor: 0xc02018destructor: 0xe02330
+destructor: 0x1202940
+in thread_main 0x1002628
+done thread_main
+destructor: 0x1002628
+in thread_main 0xc02018
+in th

Activity

  1. kleisauke commented on Jul 1, 2021

    @kleisauke
    Collaborator

    Perhaps commit f21de99 could help here? I'm not sure if that actually fixed that, but it's worth a try.

  2. sbc100 commented on Sep 1, 2021

    @sbc100
    CollaboratorAuthor

    I'm hoping that #12861 could improve flakiness around thread termination and re-use. Lets see if this one cotninues..

  3. sbc100 commented on Sep 29, 2021

    @sbc100
    CollaboratorAuthor

    I tracked down this issue to a deadlock between the detached thread
    calling printf() (calling proxied write call while hold the stdout
    lock) and the main thread trying to shut down the runtime by (calling
    fflush(0)).

    The problem could be addressed if we allowed nested calls to
    emscripten_current_thread_process_queued_calls, but in the mean
    time I have workaround in the test itself that avoids the deadlock.

  4. added 2 commits that reference this issue on Sep 29, 2021
    ff99d94
    a2fd1bc
  5. added a commit that references this issue on Sep 29, 2021
    f20313b
  6. sbc100 commented on Sep 29, 2021

    @sbc100
    CollaboratorAuthor

    My fix didn't fully address the issue and I still see occasional flakiness. We still need to address the underlying issue of exiting while threads are holding the stdio lock

  7. added 3 commits that reference this issue on Sep 30, 2021
    f68453b
    1ce93d4
    b721987
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