BurtonQin / lockbud

Statically detect memory, concurrency bugs and possible panic locations for Rust.
BSD 3-Clause "New" or "Revised" License
445 stars 25 forks source link

Support for Tokio::sync primitives #53

Open agourlay opened 1 year ago

agourlay commented 1 year ago

Thank you very much for this tool, it has helped me and my team several times to find critical deadlocks :clap:

The only missing part is having support for the primitives from Tokio::sync such as: RwLock & Mutex.

Is it even possible to track usage of asynchronous locks in a similar fashion?

If yes, I would be happy to help and contribute as it would be a game changer for my current usage of Rust.

BurtonQin commented 1 year ago

Glad you are interested in my project. The representation of async's Mutex primitives in MIR is different from that of sync. But I believe it can be done, and it's something I've always wanted to do, but I'm short on time recently.

agourlay commented 1 year ago

Happy to hear it is feasible :+1:

Could you please share some ideas to help me get started?

I have tried to add the detection of Tokio primitives in to the lock interest infrastructure.

It seems those new guards are now picked up by the analyzer but as far as I can tell the callgraphs for tokio::spawn are not generated so no deadlocks are detected.

ewoolsey commented 1 year ago

Would also love to have support for tokio. Would be a game changer for my project. This is a massively cool project, thanks so much for your efforts.