Zulip Chat Archive
Stream: lean4
Topic: Deadlock with Tasks
Thomas Vigouroux (Nov 16 2024 at 07:20):
Hey there,
I've been using tasks for a while now, and i recently updated to 4.14
It seems that this introduces a reproducible deadlock in my code.
Is there something that changed recently-ish?
Thomas Vigouroux (Nov 16 2024 at 15:35):
Wait actually, the deadlock seems to happen in earlier versions of lean, so I am definitely doing something wrong here
What are the does/don't about Tasks ?
Sebastian Ullrich (Nov 16 2024 at 15:46):
Do avoid Task.get in non-dedicated tasks as having all tasks in the thread pool wait on it will lead to deadlocks
Thomas Vigouroux (Nov 16 2024 at 16:00):
Hmm so from what I can see I only call it once...
Thomas Vigouroux (Nov 16 2024 at 16:02):
The code is here by the way: https://git.sr.ht/~vigoux/busybeaver/tree/733fdfcef00587f38e16e2c161d500516bf629a0/item/Busybeaver/Enumerate/Impl.lean
Thomas Vigouroux (Nov 16 2024 at 16:02):
The idea is that the BBComputeP
functions does some kind of parallel fold operation on a tree
Thomas Vigouroux (Nov 16 2024 at 16:03):
Does List.waitAll
count as a Task.get
?
Sebastian Ullrich (Nov 16 2024 at 16:34):
If you look at the stack traces in a debugger, it should tell you where they are stuck
Thomas Vigouroux (Nov 16 2024 at 16:35):
Can you display stakes for multiple thread though?
Henrik Böving (Nov 16 2024 at 16:46):
You can either switch to another thread and do a backtrace:
th 3
bt
or show all:
th apply all bt
Thomas Vigouroux (Nov 16 2024 at 16:51):
'Kay, I'll have a look then
From what I've seen, there remains 4 threads running and doing nothing but using each one core
Thomas Vigouroux (Nov 16 2024 at 16:52):
Which surprises me actually, is there some kind of spin loop?
Last updated: May 02 2025 at 03:31 UTC