Re: [xml] xmlParseFile gets interrupted



On Tue, Jan 08, 2008 at 08:58:33PM +0100, Florian Hanisch wrote:
Hello again.

On Sun, 30 Dec 2007 13:57:30 +0100
Florian Hanisch <florianhanisch gmx de> wrote:

Hello,

I've got a problem with the xmlParseFile function. Currently I'm
working on a XMMS plugin and within this plugin I need to parse a XML
file.
The plugin consists mainly of a pthread called worker_function:

static void *worker_function(void *arg)
{
    [...]
    xmlDocPtr doc;
    char *docname[MAX_LENGHT_URL + 1];
    [...]
    doc = xmlParseFile(docname);
    [...]
}


When I call xmlParseFile I get the following error message:

error : Interrupted function call
I/O warning : failed to load external entity
"http://musicbrainz.org/ws/1/track/?type=xml&artist=%54%68%65%20%46%69%65%72%79%20%46%75%72%6e%61%63%65%73&limit=1&title=%41%75%74%6f%6d%61%74%69%63%20%48%75%73%62%61%6e%64";


Replacing docname with a local URI (e.g. file:///path/to/file) gives
the desired result (= the parsed XML file).
The loading of the above URL works in a seperate test program.


So the question is: how do I figure out what interrupts xmlParseFile?

I did a strace -f and the only signal I could find which was sent to
thread is SIGRT_1.

I have now fixed the issue by using libcurl to get the file out of the
web and then I parse it via xmlParseDoc(). 

  Works for me from a standalone xmllint command. The signal is probably
issued as part of xmms , and libxml2 don't retry the I/O when it
interrupts the system call. Using libcurl in this context is
probably a good idea.

laptop:~ -> xmllint 
'http://musicbrainz.org/ws/1/track/?type=xml&artist=%54%68%65%20%46%69%65%72%79%20%46%75%72%6e%61%63%65%73&limit=1&title=%41%75%74%6f%6d%61%74%69%63%20%48%75%73%62%61%6e%64'
<?xml version="1.0" encoding="UTF-8"?>
<metadata xmlns="http://musicbrainz.org/ns/mmd-1.0#"; 
xmlns:ext="http://musicbrainz.org/ns/ext-1.0#";><track-list count="1" offset="0"><track 
id="bc604384-5f17-4ac1-a613-c7112bdcadcf" ext:score="100"><title>Automatic 
Husband</title><duration>128840</duration><artist id="2c916f95-f6ba-46fa-b9d8-dc0d9379f603"><name>The Fiery 
Furnaces</name></artist><release-list><release id="cfa71fc5-a0d5-489e-878c-9909480adbdd"><title>Widow 
City</title><track-list offset="2" count="16"/></release></release-list></track></track-list></metadata>
laptop:~ -> 

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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