expecto icon indicating copy to clipboard operation
expecto copied to clipboard

Deadlock/hang with printf

Open rynoV opened this issue 9 months ago • 1 comments

I ran into a deadlock in my tests where a printf call in my code was blocked. By attaching to the process using a debugger I could see in another thread the following line in Expecto's logger was also blocked:

https://github.com/haf/expecto/blob/26c5565de2305d648b2499f3030be0ac575bf91f/Expecto/Logging.fs#L1126

Removing the printfs in my code fixed the deadlock. --no-spinner didn't fix it.

The deadlock occurred inconsistently. The printf in my code was being run in a callback in another thread, so I'm guessing the lock occurs when that printf and Expecto's logging code get called too close together.

This is more of a PSA issue to help others with debugging because I can't offer a reproduction or solution, but this was a tricky issue to diagnose because I wasn't expecting something like printf to be the culprit.

rynoV avatar Feb 28 '25 17:02 rynoV

I've been working on trying to move the logger to Microsoft.Extensions.Logging. That might help. I've got some challenges to overcome with the config though

farlee2121 avatar Mar 01 '25 00:03 farlee2121