Closed Eein closed 2 years ago
I'd say you may want to check the stacktrace of the other thread, but I'm definitely thinking the hotkey presses are basically queued up to the point where the main thread is not able to make any progress anymore.
Thanks! That's what I figured.
After snooping around, I'll probably stop my project and just wait until LiveSplitOne desktop comes out, looks great so far :) I'll be on the lookout for any trivial tasks and/or linux distribution testing once it's ready.
Looks like this may be an actual bug. I'll reopen in the meantime: https://github.com/Amanieu/parking_lot/issues/212
Okay, so it looks like they identified the problem and it's not really so much of a bug, but rather an intended design decision. Basically you are not allowed to have multiple readers on the same thread at the same time, which is what's happening here:
println!("{:?} {:?} - Split {:?}",
in_ms,
timer.clone().read().current_phase(),
timer.clone().read().current_split_index(),
);
Those will only be unlocked again at the end of the print, so for a short time there's multiple.
This is now essentially resolved as we don't use parking_lot
anymore (when I merge the PR). Not sure if this applies to the locking primitives in std
as well. But it's probably by design if std
behaves like this too.
Hello :wave:
I've been toying with HotkeySystem in the core and it works great with one exception. Occasionally a thread crashes (i think) when making inputs.
I first noticed this when I was skipping splits quickly when testing my timer UI implementation.
I've made a minimal reproduction case here: https://github.com/Eein/hotkey-reproduction
This app just prints out the current timestamp, timer state, and split index in a loop. You can start the timer using AltR, then press down to skip a split, and up to undo. I found you can trigger this issue quickly by starting the timer with AltR then holding down.
I've tried without using the
timer.clone().read().x()
calls and it doesn't seem to freeze at all.Am I just accessing the timer too frequently while its trying to write changes in another thread?
using
rust-gdb
it going up the stack shows the followingIf you need a more visual test, you can pull my timer at
http://github.com/eein/glod
and checkout thesplits-refactor
branch. (you'll need gtk)Just a thought: While looking at the code I noticed the behavior for memory ordering here:
https://docs.rs/livesplit-core/0.11.0/src/livesplit_core/hotkey_system.rs.html#37
I don't have in depth knowledge but something to look at :) If I have some time in the next couple days i'll try
SeqCst
ordering for sanity.Systems Tested PopOs 19.10 5.3.0 kernel - Gnome Manjaro 5.4 kernel - Gnome