Bug #49634 [Com]: Segfault throwing an exception in a XSL registered function

From: Date: Tue, 14 Jul 2015 18:58:16 +0000
Subject: Bug #49634 [Com]: Segfault throwing an exception in a XSL registered function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194442@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=49634&edit=1

 ID:                 49634
 Comment by:         mplomer at gmx dot de
 Reported by:        aldo at armiento dot com
 Summary:            Segfault throwing an exception in a XSL registered
                     function
 Status:             Closed
 Type:               Bug
 Package:            XSLT related
 Operating System:   Linux Debian, Mac OSX
 PHP Version:        5.*
 Assigned To:        mike
 Block user comment: N
 Private report:     N

 New Comment:

As this bug is already closed, I opened a new one: Bug #70078


Previous Comments:
------------------------------------------------------------------------
[2015-07-13 23:04:15] mplomer at gmx dot de

I can confirm the performance problem. My script processes bigger XML-files and makes much use of
PHP function calls inside XSL and passes references to nodes to them.
After upgrading to PHP version 5.6.11, the script hits the 2 GB memory limit and sometimes segfaults
- with the old PHP version it uses max 20-40 MB memory. (Version until 5.4.23 worked fine, starting
with 5.4.24 not; maybe the same somewhere in 5.6 branch)

Seems to be also a memleak here ...

------------------------------------------------------------------------
[2014-12-26 13:04:48] dmitry dot koterov at gmail dot com

Seems to me, this fix reduces the performance greatly. Let's review your fix again:
https://github.com/php/php-src/commit/6408a1a59e6d371cd488687e28e18815ea97984e#diff-258cc1cabc37df15d7f0ed40924f64efL281

Note that xmlDocCopyNodeList() does "a recursive copy of the node list": http://xmlsoft.org/html/libxml-tree.html#xmlDocCopyNodeList

E.g. if I have a 10MB XML document and call

<xsl:value-of select="php:function('someFunction', /, 'abc')" />

in an XSLT, the whole 10M XML document will be copied before calling someFunction(). It hasn't
been copied in PHP 5.3, so we have a significant performance penalty here.

Is there another way to achieve the same behavior with no libxml2 node cloning?

------------------------------------------------------------------------
[2014-10-07 23:27:38] stas@php.net

Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=6408a1a59e6d371cd488687e28e18815ea97984e
Log: fix bug #49634x

------------------------------------------------------------------------
[2014-10-07 23:16:31] stas@php.net

Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=6408a1a59e6d371cd488687e28e18815ea97984e
Log: fix bug #49634x

------------------------------------------------------------------------
[2013-12-02 16:51:36] ab@php.net

Automatic comment on behalf of mike
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6408a1a59e6d371cd488687e28e18815ea97984e
Log: fix bug #49634x

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=49634


--
Edit this bug report at https://bugs.php.net/bug.php?id=49634&edit=1


Thread (14 messages)

« previous php.bugs (#194442) next »