2 May 19:14
threading fixed :)
From: Stefan Behnel <stefan_ml <at> behnel.de>
Subject: threading fixed :)
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-02 17:16:34 GMT
Subject: threading fixed :)
Newsgroups: gmane.comp.python.lxml.devel
Date: 2008-05-02 17:16:34 GMT
Hi,
there has been a long-standing issue in the threading support in lxml,
combined with the per-thread string hash table we use for libxml2.
Here is a simple example of a sure crasher:
-------------------------------
import threading
import lxml.etree as et
xml = "<root><threadtag/></root>"
main_root = et.XML("<root/>")
def run_thread():
thread_root = et.XML(xml)
main_root.append(thread_root[0])
del thread_root # deletes the document
thread = threading.Thread(target=run_thread)
thread.start()
thread.join()
print et.tostring(main_root)
-------------------------------
This crashes, because the thread parses the XML fragment into its own
dictionary and stores the tag name "threadtag" there. Then it appends the
(Continue reading)
RSS Feed