-
Notifications
You must be signed in to change notification settings - Fork 1
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
Such threadsafe, much wow #4
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4 +/- ##
==========================================
+ Coverage 86.20% 86.63% +0.42%
==========================================
Files 10 10
Lines 1965 1983 +18
==========================================
+ Hits 1694 1718 +24
+ Misses 271 265 -6 ☔ View full report in Codecov by Sentry. |
src/cluster.jl
Outdated
if jw.state === W_CREATED | ||
lock(jw.c_state) do | ||
wait(jw.c_state) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems potentially incorrect; shouldn't the equality comparison be within the lock
block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes I think you're right, especially since the docstring for c_state
says:
c_state::Threads.Condition # wait for state changes, lock for state
Fixed in 9283e6f. But I see that Worker.state
is an atomic, should we also be doing atomic reads of that variable everywhere else too? AFAICT most reads are currently non-atomic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably switch to acquire-release, or keep everything seq-cst for now (reads without @atomic
are :monotonic
, so we should probably do reads as @atomic :sequentially_consistent jw.state
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acquire-release is probably more than strong enough for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty, fixed in 8e35ba4. I stuck to seq-cst just because that's the default for @atomic
.
@@ -0,0 +1,64 @@ | |||
using Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to also enable JULIA_NUM_THREADS
in CI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have to because this test sets up its own workers with multiple threads in the exeflags
variable. But I also don't have any objection to starting every worker in the tests with multiple threads anyway, maybe it'd be easier to shake out bugs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have to because this test sets up its own workers with multiple threads in the exeflags variable.
Ahh yes, I missed that!
But I also don't have any objection to starting every worker in the tests with multiple threads anyway, maybe it'd be easier to shake out bugs?
It's up to you - I think it could be valuable to try, but maybe we wait for the @async
-> Threads.@spawn
change, to be able to see what happens when tasks get assigned to other threads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we might as well go for it now, added in 8e35ba4.
BTW please don't merge this with the fixup commits, once it's ready to merge I'll rebase and squash them. |
Definitely some fishy failures in the latest CI run.
|
Now all the SSH tests pass, but:
I'm going to refactor the tests into |
Put all the tests in |
b5dcd9d
to
68482e6
Compare
2ea7f38
to
880eebe
Compare
Necessary because LibSSH is not thread-safe.
This makes it much easier to see where errors/warnings are coming from. The tests have been preserved in the exact order they were written, with no changes other than the necessary ones to put them in `@testset`'s (e.g. creating modules in global scope).
880eebe
to
c1a3be8
Compare
No luck with the |
Relanded from: JuliaLang/Distributed.jl#101
As discussed offline this skips the last couple of commits to replace
@async
withThreads.@spawn
, though I did keep f98c4ca since I figured it couldn't hurt.