Re: [xslt] Seg fault handling multiple transformations with XML::LibXSLT

On Mon, Mar 04, 2002 at 02:46:34AM -0800, Christopher R. Maden wrote:
> I'm using Matt Sergeant's excellent XML::LibXML and XML::LibXSLT Perl 
> interfaces to libxml and libxslt.  I've encountered a somewhat bizarre 
> situation that leads to a segmentation fault.
> I'm using:
>     libxml 20413
>     libxslt 10010
> I instantiate a single XML parser and a single XSLT engine:
>      $parser = XML::LibXML->new();
>      $xslt = XML::LibXSLT->new();
> and parse the stylesheet once:
>          $stylesheet = $xslt->
>              parse_stylesheet_file( $Config::SPLIT_TRANSFORM );
> Then, in a foreach loop, I parse an XML string and transform it:
>          $xmlsource = $parser->parse_string( $xmlstring );
>          $result = $stylesheet->transform( $xmlsource, %xsltparams );

  Hum, one of the changes which made into libxslt-1.0.12 is labelled in the
Changelog as "adding extra run-time informations to make the stylesheet
really read-only at run-time." It may be worth trying to upgrade to the
2.4.16/1.0.12 combo before spending too much time chasing this down.

> Now, here's the fun part.  I'm testing this with two input files and two 
> stylesheets.  If I only handle one file at a time, no problem.  If I use 
> the one-page stylesheet, no problem.  If I use the split stylesheet (which 
> uses xsl:document) and handle the files in reverse order, no problem.  But 
> if I handle the files in the default order, with the split stylesheet, and 
> both in one pass, I get a segmentation fault.
> ?!?!?

  Ouch, my head hurts ... So basically the test case exhibiting this made
use of xsl:document to output multiple documents and the order in which
the document are generated is important to trigger the crash, right ?

> My guess is that there's some data structure in the stylesheet object 
> that's getting put in a weird state by the first file and then breaks when 
> accessed by the second file, or something like that.  But I really have no 
> idea where to begin looking.  I've tried to create a reproduction case, but 
> I haven't been able to so far.

  I have had previously one such report of a stylesheet reuse which would
lead to a similar crash, but the person was never able to provide me with
an isolated test case. He was also using Windows.

> Pointers are gladly welcomed.

  Hum, there is the library internals:
but I'm not sure you really want to get into this.
Any chance you could try to isolate a stack trace showing where the bug
actually occurs. Running with verbose output (dunno if it's possible with
XML::LibXSLT) could also provide an indication of the sequence leading to
the crash.
Also this seems related to multiple thread accessing the engine simultaneously
I don't remember if libxml2/libxslt is built natively with thread support in
Cygwin, maybe someone could tell me more about that part,


Daniel Veillard      | Red Hat Network  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]