[lxml-dev] Error with thread

Dmitri Fedoruk dfedoruk at gmail.com
Mon Dec 3 14:17:52 CET 2007


Hello,

Looks like I've got the same problem.
Sometimes I get the same error message: 'stylesheet is not usable in
this thread'. As far as I could understand, that's because of an
attempt to use in one thread the xslt obejct initiated in another
thread. Sounds reasonable.

> Correct. As I said, a work-around would be to either create them on the fly or
> cache the XSLT objects in thread-local storage and reuse them from there.

Nice. My application works under the same scheme. I'm using mod_python
and several apache processes started in prefork mode. In every apache
process I'm using a global general object that contains xslt objects
inside. When a request comes to the next apache process, my general
object is initialized (if it has not been done yet) and then is used
inside this thread and this process. I cannot see the reason why one
instance of mod_python should conflict with another.

Nevertheless, I happen to get this error messages without any idea
why. I can not see any dependency or rule yet. The only solution is to
restart apache.

My software is the following:
Apache/2.0.61
Python 2.5.1
mod_python-3.3.1
lxml-1.3.4
libxslt-1.1.20
freebsd 6.2-20070330-SNAP

Do you have any idea how can I fix this situation or at least how can
I track the reasons? Maybe this is the question for some other mailing
lists too?

Dmitri


More information about the lxml-dev mailing list