Re: [xml] IO callbacks are not thread-safe
- From: Daniel Veillard <veillard redhat com>
- To: Nick Wellnhofer <wellnhofer aevum de>
- Cc: xml gnome org
- Subject: Re: [xml] IO callbacks are not thread-safe
- Date: Thu, 2 Apr 2009 17:09:26 +0200
On Thu, Mar 26, 2009 at 07:06:14PM +0100, Nick Wellnhofer wrote:
The input and output callbacks of libxml are stored in static arrays in
xmlIO.c, so any use of the callback functions is not thread-safe.
In many cases this shouldn't be a problem, if callbacks are registered
only at the start of a program. But the Perl bindings register and
unregister callbacks every time a document is parsed. I can reproduce
That sounds severely broken to me. Can you details why, and how ?
random segfaults or other errors when processing many thousand documents
in concurrent threads with the libxml Perl bindings.
I'm willing to help fix this, but I'm not sure about the correct
approach. Should the callback arrays be added to the global variables in
Those variables are not public, so I guess a different way would be
preferable. Still I can't see any good valid reason to change the values
all the time. Something is severely broken there in the perl bindings !
If they need a per parsing instance processing they should use the data
block provided by the I/O to make the switch, but register an unified
routine for all threads. No really this doesn't make any sense to me,
but maybe you can come up with a valid reason,
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
] [Thread Prev