-
Notifications
You must be signed in to change notification settings - Fork 94
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
[r2r] Avoid deadlock on DuplexMutex
#1453
Conversation
* Replace `DuplexMutex` with `parking_lot::Mutex` as it's more reliable * Refactor `log.rs` to avoid locking multiple mutexes at the same time * Replace `Relaxed` with `SeqCst`
Please note that it was difficult to figure out the relationship between different atomic variables, so I used |
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.
Good that we no longer need duplex mutex implementation. Great work!
But the log module implementation seems so harmful. I think we can optimize this much much better. Should we do this in this PR or create an issue as another task?
@ozkanonur that would be awesome.
It's not a trivial task, I already tried to refactor it before, but I just got gray hair 😁. Let's postpone the refactoring
|
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.
LGTM 🔥
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.
LGTM!
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.
Nice! This looks great.
@sergeyboyko0791 this should help https://www.youtube.com/watch?v=rMGWeSjctlY |
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.
Great work 🔥 ! Only some non-blocker comments :)
DuplexMutex
DuplexMutex
* Import `parking_lot::Mutex` as `PaMutex`
946cfaa
DuplexMutex
DuplexMutex
@cipig could you please run a node with these changes to test if the problem reproduces? |
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.
Re-Approve
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.
👍
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 updated all my 6 nodes to this version. Will try to reproduce. I guess many parallel swaps with same coin (so many swaps finish at the same time, when a block arrives) was triggering 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.
started 2000 swaps like this (same that did crash the node last time)
#!/bin/bash
for i in {1..2000}
do
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"buy\",\"base\":\"TKL\",\"rel\":\"KMD\",\"volume\":0.01,\"price\":0.013}"
sleep 0.01
done
and no crash in log.rs
DuplexMutex
withparking_lot::Mutex
as it's more reliablelog.rs
to avoid locking multiple mutexes at the same timeRelaxed
withSeqCst
ordering.