Message365761
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. |
|
Date |
User |
Action |
Args |
2020-04-04 12:10:23 | dhess | set | recipients:
+ dhess, terry.reedy, steve.dower, ukl |
2020-04-04 12:10:23 | dhess | set | messageid: <1586002223.47.0.130637204125.issue40139@roundup.psfhosted.org> |
2020-04-04 12:10:23 | dhess | link | issue40139 messages |
2020-04-04 12:10:23 | dhess | create | |
|