Skip to content
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

Fix a couple of bugs in the thread test #3765

Merged
merged 2 commits into from Apr 5, 2019

Conversation

Projects
None yet
2 participants
@msimberg
Copy link
Contributor

commented Apr 3, 2019

Proposed Changes

  • Add option to not retry setting state when target thread is active
  • Don't retry setting state when interrupting a thread
  • Remove some barriers from parts of the thread test to avoid rare hang

More details in commit messages.

msimberg added some commits Apr 3, 2019

Remove unnecessary barriers in thread test and fix rare deadlock
Barriers were there to ensure that join does not throw. However, join is only an
interruption point for the parent thread, not the thread being interrupted, so
the barriers are not needed.

In addition this fixes a bug which would be caused by the `b->wait` in
`interruption_point_thread` also acting as an interruption point (the barrier
suspends on a condition variable). This is rare but possible. When this happens
the barrier `wait` function throws an exception (`thread_interrupted`) but
cannot decrement the total count that it was waiting for. This eventually leads
to the barrier destructor waiting indefinitely for all threads to enter the
barrier.
Add option to not retry setting thread state if state is active
Disable retrying when interrupting a thread. Retrying is unnecessary since the
thread will either exit by itself or suspend and hit an interruption point. It
also fixes a bug wher e the retrying thread wakes up after the target thread has
been terminated and deleted, and then tries to unsuccessfully set the new thread
state.
@hkaiser

hkaiser approved these changes Apr 3, 2019

Copy link
Member

left a comment

Good thinking!

@hkaiser hkaiser merged commit 058b1e1 into STEllAR-GROUP:master Apr 5, 2019

11 of 16 checks passed

pycicle daint-clang-7.0-boost-1.68.0-c++17-nonetworking-Debug Test errors 7
Details
pycicle daint-gcc-7.3.0-boost-1.68.0-c++17-Release Build errors 11
Details
pycicle daint-gcc-7.3.0-boost-1.68.0-c++17-Release Test errors 1
Details
pycicle daint-gcc-7.3.0-cuda-9.2.148_3.19-6.0.7.1_2.1__g3d9acc8-boost-1.68.0-c++11-Release Build errors 48
Details
pycicle daint-gcc-7.3.0-cuda-9.2.148_3.19-6.0.7.1_2.1__g3d9acc8-boost-1.68.0-c++11-Release Test errors 10
Details
build-and-test Workflow: build-and-test
Details
pycicle daint-clang-3.8-boost-1.58.0-c++11-Release Build errors 0
Details
pycicle daint-clang-3.8-boost-1.58.0-c++11-Release Config errors 0
Details
pycicle daint-clang-3.8-boost-1.58.0-c++11-Release Test errors 0
Details
pycicle daint-clang-7.0-boost-1.68.0-c++17-nonetworking-Debug Build errors 0
Details
pycicle daint-clang-7.0-boost-1.68.0-c++17-nonetworking-Debug Config errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-Debug Build errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-Debug Config errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-Debug Test errors 0
Details
pycicle daint-gcc-7.3.0-boost-1.68.0-c++17-Release Config errors 0
Details
pycicle daint-gcc-7.3.0-cuda-9.2.148_3.19-6.0.7.1_2.1__g3d9acc8-boost-1.68.0-c++11-Release Config errors 0
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.