XML::LibXML - tracking the error

Ranguard on 2003-02-25T09:17:20

Senario:
XML Import system on staging server works fine - then goes intermittent, then stops completly.



Error message: "Can't coerce UNKNOWN to string in entersub at /usr/local/lib/perl/5.6.1/XML/LibXML.pm line 239"

Guess 1 - search google for answer - nothing

Guess 2 - the system which generates the XML is going wrong (has happened many times - nasty VB thing). - Wrong - can run the import on the development machine fine.

Guess 3 - hmm, the libxml2 library is a few versions different, role back to the same one that is on the development machine, still not working.

Several hours of trying stuff at random later - nothing, then I notice that we have a problem with a CGI script on the staging server - in fact it's spawning child processes and reaching MaxClients then freezing apache.

Then the answer hits me - the XML has ENTITY tags - which are found on the local web server (e.g. which ever server the import script is running). So if XML::LibXML is trying to parse the file and can't read the .ent files (as the web server isn't responding) then it dies with that - oh so helpful - error message!

An hour later - having written a 'hello world' script, that still takes the apache server down and stripped the config to the bones, I find that someone has both a 'ScriptAlias' and ProxyPass (with the ProxyPassReverse) set up for /cgi-bin/ - obviously you should never have both - but I wouldn't have expected it to cause some sort of spawning loop.

Anyway - removed the ProxyPass stuff restarted apache - it no longer hung - ran the import script - it worked fine - every time.

I wish the error had been clearer in the first place as it would have saved me half a day of work.