[Python-Dev] Dealing with import lock deadlock in Import Hooks (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Tue Aug 13 08:50:00 CEST 2013
- Previous message: [Python-Dev] Dealing with import lock deadlock in Import Hooks
- Next message: [Python-Dev] Dealing with import lock deadlock in Import Hooks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 13 Aug 2013 11:06:51 +0900 Arnaud Fontaine <arnaud.fontaine at nexedi.com> wrote:
Hi,
Armin Rigo <arigo at tunes.org> writes: > On Mon, Aug 12, 2013 at 9:39 AM, Arnaud Fontaine <arnaud.fontaine at nexedi.com> wrote: >> Thread 1 is trying to import a module 'foo.bar' (where 'foo' is a >> package containing dynamic modules) handled by Import Hooks I >> implemented, so import lock is acquired before even running the hooks >> (Python/import.c:PyImportImportModuleLevel()). Then, these import >> hooks try to load objects from ZODB and a request is sent and handled >> by another thread (Thread 2) which itself tries to import another >> module. > > A quick hack might be to call imp.releaselock() and > imp.acquirelock() explicitly, from your import hook code, around > calls to ZODB. I suggested the same in my initial email, but I was wondering if there could be any issue by releasing the lock in findmodule()/loadmodule() until the module is actually added to sys.modules.
Well, you are obviously on your own with such hacks. There is a reason the lock exists.
Regards
Antoine.
- Previous message: [Python-Dev] Dealing with import lock deadlock in Import Hooks
- Next message: [Python-Dev] Dealing with import lock deadlock in Import Hooks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]