Strptime multi threading issue replication and its solution.
Python's strptime when access by more then one threads simultaneously, it only allows the execution of one thread and throws exception at rest of the other threads.
Python's strptime is not threadsafe therefore to implement multi threading strptime uses ImportModuleNoBlock
to drop another thread if its executing a thread.
A hack which works is by calling the strptime well before the creation of the threads. In a web application, the strptime dummy call can be added in the wsgi file.
# To replicate the issue
python strptime_issue.py Replicate
# To fix the issue
python strptime_issue.py Fix