This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dhess
Recipients dhess, steve.dower, terry.reedy, ukl
Date 2020-04-04.12:10:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1586002223.47.0.130637204125.issue40139@roundup.psfhosted.org>
In-reply-to
Content
I’m not sure I can shed any light on this particular bug, but I would say that based on my dealings with this module, it is definitely not thread-safe. That means that if you are going to have multiple threads accessing it simultaneously, you really should have a mutex around that access ensuring only one thread is running through the code in this module at a time. 

Now in reality, asyncio and other cooperatively scheduled multi-processing packages like gevent are not going to unpredictably yield control to another thread like true threads will. So, in this particular case, since the init code doesn’t use async or await, I don’t think there is a chance of an initialization race bug there. 

As to the bug witnessed, the only thing I can suggest is to add a considerable amount of debugging that logs the argument to guess_type and prints out the mimetype module’s internal state if and when this happens again. My best guess based on the amount of work that method does to inspect the passed in url, is that it has something to do with the url itself.
History
Date User Action Args
2020-04-04 12:10:23dhesssetrecipients: + dhess, terry.reedy, steve.dower, ukl
2020-04-04 12:10:23dhesssetmessageid: <1586002223.47.0.130637204125.issue40139@roundup.psfhosted.org>
2020-04-04 12:10:23dhesslinkissue40139 messages
2020-04-04 12:10:23dhesscreate