#30186 [Fbk->Opn]: passing empty string to xml_parser_create causes 100% CPU utilization

From: Date: Mon, 27 Sep 2004 18:23:47 +0000
Subject: #30186 [Fbk->Opn]: passing empty string to xml_parser_create causes 100% CPU utilization
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-66776@lists.php.net to get a copy of this message
 ID:               30186
 User updated by:  johnkarl at nbnet dot nb dot ca
 Reported By:      johnkarl at nbnet dot nb dot ca
-Status:           Feedback
+Status:           Open
 Bug Type:         XML related
 Operating System: Windows 2000 Professional SP4
 PHP Version:      5.0.1
 New Comment:

Just tried it out with the snapshot you provided and still the same
problem. Here are my specs:

Windows 2004 Professional SP4
Apache/2.0.49

My workaround is to check the PHP version, and omit the empty string
parameter if version >= 5

This isn't an isolated problem, either. I became aware of this through
several individuals using my open source libraries. I'm not certain
what they were running but I can proably find out if you can't
replicate the problem.

John


Previous Comments:
------------------------------------------------------------------------

[2004-09-27 19:47:43] iliaa@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

Seems to work fine in recent code.

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

[2004-09-21 21:11:55] johnkarl at nbnet dot nb dot ca

Description:
------------
In PHP5, if xml_parser_create is called with an empty string as the
character encoding parameter, a server will utilize 100% of the CPU.
Restarting Apache will sometimes cause the system to revert to normal,
but usually a reboot is needed.

In PHP4, calling xml_parser_create("") will cause Expat to autodetect
the character encoding. In the user comments of www.php.net, this is
purportedly true of PHP5 as well; however this is not the case.

This problem has been reproduced on a number of other machines as well.
I'm not sure if the same happens with IIS.

Reproduce code:
---------------
$parser = xml_parser_create("");

Expected result:
----------------
a reference to the parser should be returned

Actual result:
--------------
Apache stalls, 100% CPU usage


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


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


Thread (6 messages)

« previous php.bugs (#66776) next »