mvniekerk / tokio-cron-scheduler

Schedule tasks on Tokio using cron-like annotation
Apache License 2.0
529 stars 59 forks source link

Sporadic deadlock happens on v0.6.0 #16

Closed BlackDex closed 2 years ago

BlackDex commented 2 years ago

First of all thanks for this crate!

While trying to remove the very old time v0.1 crate dependency (Which i did manage to do) i bumped into a sporadic deadlock. It's not happening all the time, and it does happen with both the my patched version and the un-patched version.

If i use v0.5.0 of this crate it works just fine, no issue what so ever (also not with miri). I tried both the latest nightly and stable versions of Rust.

Executing the example with miri results in a deadlock error which does not happen with the v0.5.0 version.

MIRIFLAGS="-Zmiri-disable-isolation" cargo miri run --example simple_job

Looks like it has something to do with mpsc, but I'm not to familiar with that to really debug it that well.

mvniekerk commented 2 years ago

Hi @BlackDex Thank you for the bug report. I'm almost at the verge of releasing beta 2 of the 0.6. It has a big architecture change around it, it'll be interesting to see if the this problem persists. Holding thumbs because deadlocks aren't the most joyful thing to clear out

BlackDex commented 2 years ago

It looks like i'm not getting a deadlock right now anymore. But i do get some errors sometimes when running the simple example. I guess that is also not the correct outcome.

Even though miri still complains about a possible deadlock, it could be that async/await is causing it to have some issues since miri could have same issues with async/await code.

Also, i think you should be able to move-out tracing-subscriber from the normal dependencies since it is nowhere used in the code it self, and it causes an extra dependency to be loaded while it is only needed for all the examples (So it is not optional right now).

mvniekerk commented 2 years ago

Hi @BlackDex So yes I'm getting the same errors. Need to fix it before stable release - when I looked into it seems to stemming from the std mpsc receiving a value but still complaining not being to send it. As to tracing-subscriber, I'm only using it in the examples - it is marked as optional and only enabled in the examples.

I'm glad the locks are in a better state.

mvniekerk commented 2 years ago

Do you think we can close this?

BlackDex commented 2 years ago

Since the deadlocks seems to be gone (for now) i think ill close it.