WaitHandle.WaitAny will deadlock if the thread is interrupted.
This happens to mdtool: it calls WaitAny and at process shutdown waits for the thread to finish. The thread has been interrupted, so the WaitAny will never return, thus the process will never exit either.
Created attachment 3002 [details]
Rodrigo, I believe this is somewhat your area, can you review the attached patch?
It looks like this was detected some time ago: https://bugzilla.novell.com/show_bug.cgi?id=549807#c5
The patch looks good except the remaining time calculation doesn't handle ticks overflow.
Nerver mind, we're using unsigned math already which handles this fine. So, patch looks good, please commit.
Would it be better to use mono_100ns_ticks instead of mono_msec_ticks? If I did the math right it won't overflow in 29k years.
It doesn't matter, both are monotonic, which is important. The current schema would only be a problem if we get 2 wrap around in the same call, which is not an issue at all.
From the implementation of mono_msec_ticks it looks like it will overflow every 49 days (the number of ms that fit in a uint32).
A slightly different version has been committed.
*** Bug 7003 has been marked as a duplicate of this bug. ***