I was fighting four days now, with a threading problem, which are known to be hard to track. But I finally found it and learned that I actually had made a beginner’s mistake.
What happened?
From the front end I trigger via AJAX a view that again starts a
thread that does some import work, that might take quite a while.
This enables the user to keep going and have the import run
without interrupting him/her. Every once in a while an
asynchronous call checks on the state of the import.
And here lies the problem: while the thread is running and busy
like a bee adding data in the DB the asynchronous call to check
on the state also tries to run a query and that causes the
following exception:
...
File "/Users/cain/programming/django/trunk/django/db/backends/mysql/base.py",
line 42, in execute
return self.cursor.execute(sql, params)
File …[Read more]