Leaked semaphore objects - 🙀

Hi, Marc & fellow Scampsters.

I’m going through Marc’s excellent video about using forks and I keep getting this message after every run:

/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 2 leaked semaphore objects to clean up at shutdown

warnings.warn('resource_tracker: There appear to be %d ’

What is this about, and how to I fix it?



I’m not sure how to track this down! Does anyone else encounter this warning outside of Thonny? Because I think i may be a Thonny-specific issue, but I’m not sure.

Oh, but I should also say, it doesn’t seem to affect anything, I think, and you can ignore it. It’s just a bit annoying.

Thanks, Marc. When I saw Leaked semaphore objects I thought I was reading the summary from my last doctor’s visit :confused:

@MarcEvanstein I did a bit of snooping online, and this seems to be a common problem. It’s not specific to Thonny because others have it using different IDEs. However, from the comments I read, it seems to be Mac-specific. Can anyone confirm?

Also, it happens only when I use fork(), so whatever fork calls (or uses?) has something to do with it.