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

Thread-safety improvements #122

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Thread-safety improvements #122

wants to merge 10 commits into from

Conversation

JamesWrigley
Copy link
Collaborator

@JamesWrigley JamesWrigley commented Jan 22, 2025

CC @jpsamaroo

This should fix an exception seen in CI from the lingering timeout task:
```
 Test Summary:                                | Pass  Total  Time
Deserialization error recovery and include() |   11     11  3.9s
      From worker 4:	Unhandled Task ERROR: EOFError: read end of file
      From worker 4:	Stacktrace:
      From worker 4:	 [1] wait
      From worker 4:	   @ .\asyncevent.jl:159 [inlined]
      From worker 4:	 [2] sleep(sec::Float64)
      From worker 4:	   @ Base .\asyncevent.jl:265
      From worker 4:	 [3] (::DistributedNext.var"#34#37"{DistributedNext.Worker, Float64})()
      From worker 4:	   @ DistributedNext D:\a\DistributedNext.jl\DistributedNext.jl\src\cluster.jl:213
```
@JamesWrigley JamesWrigley self-assigned this Jan 22, 2025
@@ -44,6 +44,7 @@ jobs:
- uses: julia-actions/julia-runtest@v1
env:
JULIA_DISTRIBUTED_TESTING_STANDALONE: 1
JULIA_NUM_THREADS: 4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
JULIA_NUM_THREADS: 4
JULIA_NUM_THREADS: 4,4

Shake out having lots of threads in both pools?

Copy link
Collaborator Author

@JamesWrigley JamesWrigley Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep makes sense; fixed in 2874281.

@JamesWrigley
Copy link
Collaborator Author

The test failures are coming from replacing @async with Threads.@spawn, we didn't merge that commit in DistributedNext because it would've required more testing: JuliaParallel/DistributedNext.jl#4 (comment)

I think it's best to be conservative with this update so I'm going to revert that commit.

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

Attention: Patch coverage is 78.04878% with 9 lines in your changes missing coverage. Please review.

Project coverage is 79.50%. Comparing base (0e27cd1) to head (2be833c).

Files with missing lines Patch % Lines
src/cluster.jl 76.92% 6 Missing ⚠️
src/managers.jl 50.00% 1 Missing ⚠️
src/messages.jl 50.00% 1 Missing ⚠️
src/process_messages.jl 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #122      +/-   ##
==========================================
+ Coverage   79.29%   79.50%   +0.21%     
==========================================
  Files          10       10              
  Lines        1922     1918       -4     
==========================================
+ Hits         1524     1525       +1     
+ Misses        398      393       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The `launched_q` array is filled concurrently by the launcher tasks for each
worker. Now it's wrapped inside `Base.Lockable` for thread-safety.
@JamesWrigley
Copy link
Collaborator Author

As discussed offline, added back the commits replacing @async with Threads.@spawn and fixed the CI failure in 877be4f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants