[XML-SIG] Advice on how to deal with locking problems using python-wrapped C libs in MT frameworks like Zope/Twisted?

Martin v. Löwis martin@v.loewis.de
30 Mar 2003 23:26:46 +0200


Craeg K Strong <cstrong@arielpartners.com> writes:

> When libxslt tries to resolve the relative URL, a request is going out
> to grab:
> 
> http://127.0.0.1:55068/testFolder_1_/arielpartners/propfolder/foo/properties
> 
> which ends up coming back in to Zope.  Zope is multi-threaded, so why
> shouldn't that be able to return successfully?  Is libxslt-python somehow
> holding on to the GIL or-- maybe it is still in the middle of the "read"
> call and is therefore holding a lock on that resource?

One would have to know a lot of internal details here that you
probably have to investigate yourself, unless you can find some
Zope-and-libxslt guru. Here are some theories:

1. Zope is not responding since it considers the request incomplete
   One would have to study the 88 bytes request data (use -s2000 on
   strace) to determine whether the request is complete - yet Zope
   may *still* waiting for more data for some reason (e.g. a bug).
2. Zope is not configured to process more than one request. It accepts
   the connection only since this is in the listen backlog; it doesn't
   actually read the data - not because it couldn't, but because it
   does not want to.
3. The GIL is held while libxslt makes this request.

If I think long enough, I can come up with more consistent theories :-)
Which of these are plausible, I don't know; most likely, the real
reason would not give a plausible theory.

What mechanism in libxslt does make the callback? Is that Python code,
or code implemented in libxslt itself?

Regards,
Martin