You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Kosaraju Karuna-C9013Z <C9...@motorola.com> on 2007/05/24 17:29:12 UTC

Segmentation Fault with parseURI API

Hi all,
 
We are using xerces-c v 2.6 to load XML file using DOM during our
application initialization.
Our input XML is of size 90 KB. 
 
On target Network Element, our application always segfaults during the
initialization and we figured out that the crash is exactly at the API
parseURI(). We are already handling the DOMException, SAXException and
XMLExceptions. But in this case, none of the exceptions are being
caught. When we reduced the size of input XML to 19 KB, the segfault was
not observed. Were there any memory constraints with parseURI() ??
 
Note that this behavior is observed only on 1 specific NE. The same code
works on different NE's. How will parseURI behaves if sufficient memory
is not available to load the XML? Any pointers on how to approach this
problem will be appreciated.
 
Thanks,
Karuna

RE: Segmentation Fault with parseURI API

Posted by Alberto Massari <am...@datadirect.com>.
At 13.44 24/05/2007 -0400, Kosaraju Karuna-C9013Z wrote:
>Hi Alberto,
>
>The schema's are Motorola proprietary. I may not be able to share them.
>But, let me know if you want me to verify anything in particular. How is
>maxOccurs going to affect us?
>Also, the library which has DOM API calls is linked to binary which is
>multi-threaded.
>Can this be a problem? We have compiled xerces with -rpthread option. I
>hope this makes it thread-safe. Any comments?

As stated in http://xml.apache.org/xerces-c/schema.html, large 
minOccurs/maxOccurs values results in the stack overflow or large 
memory allocations, and should be avoid (the actual threshold depends 
on the schema shape, but 500 could be a safe value). Sorry, but 
without seeing the actual XML/XSD/code, it's hard to tell you more....

Alberto


>Thanks
>Karuna
>
>-----Original Message-----
>From: Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Thursday, May 24, 2007 12:26 PM
>To: c-users@xerces.apache.org
>Subject: Re: Segmentation Fault with parseURI API
>
>Hi Karuna,
>90Kb is a size that should not trigger any out-of-memory exception;
>could you share the XML with us? Maybe it references a schema that
>contains large maxOccurs values....
>
>Alberto
>
>At 11.29 24/05/2007 -0400, Kosaraju Karuna-C9013Z wrote:
> >Hi all,
> >
> >We are using xerces-c v 2.6 to load XML file using DOM during our
> >application initialization.
> >Our input XML is of size 90 KB.
> >
> >On target Network Element, our application always segfaults during the
> >initialization and we figured out that the crash is exactly at the API
> >parseURI(). We are already handling the DOMException, SAXException and
> >XMLExceptions. But in this case, none of the exceptions are being
> >caught. When we reduced the size of input XML to 19 KB, the segfault
> >was not observed. Were there any memory constraints with parseURI() ??
> >
> >Note that this behavior is observed only on 1 specific NE. The same
> >code works on different NE's. How will parseURI behaves if sufficient
> >memory is not available to load the XML? Any pointers on how to
> >approach this problem will be appreciated.
> >
> >Thanks,
> >Karuna


RE: Segmentation Fault with parseURI API

Posted by Kosaraju Karuna-C9013Z <C9...@motorola.com>.
Hi Alberto,

The schema's are Motorola proprietary. I may not be able to share them.
But, let me know if you want me to verify anything in particular. How is
maxOccurs going to affect us?
Also, the library which has DOM API calls is linked to binary which is
multi-threaded.
Can this be a problem? We have compiled xerces with -rpthread option. I
hope this makes it thread-safe. Any comments?

Thanks
Karuna 

-----Original Message-----
From: Alberto Massari [mailto:amassari@datadirect.com] 
Sent: Thursday, May 24, 2007 12:26 PM
To: c-users@xerces.apache.org
Subject: Re: Segmentation Fault with parseURI API

Hi Karuna,
90Kb is a size that should not trigger any out-of-memory exception;
could you share the XML with us? Maybe it references a schema that
contains large maxOccurs values....

Alberto

At 11.29 24/05/2007 -0400, Kosaraju Karuna-C9013Z wrote:
>Hi all,
>
>We are using xerces-c v 2.6 to load XML file using DOM during our 
>application initialization.
>Our input XML is of size 90 KB.
>
>On target Network Element, our application always segfaults during the 
>initialization and we figured out that the crash is exactly at the API 
>parseURI(). We are already handling the DOMException, SAXException and 
>XMLExceptions. But in this case, none of the exceptions are being 
>caught. When we reduced the size of input XML to 19 KB, the segfault 
>was not observed. Were there any memory constraints with parseURI() ??
>
>Note that this behavior is observed only on 1 specific NE. The same 
>code works on different NE's. How will parseURI behaves if sufficient 
>memory is not available to load the XML? Any pointers on how to 
>approach this problem will be appreciated.
>
>Thanks,
>Karuna


Re: Segmentation Fault with parseURI API

Posted by Alberto Massari <am...@datadirect.com>.
Hi Karuna,
90Kb is a size that should not trigger any out-of-memory exception; 
could you share the XML with us? Maybe it references a schema that 
contains large maxOccurs values....

Alberto

At 11.29 24/05/2007 -0400, Kosaraju Karuna-C9013Z wrote:
>Hi all,
>
>We are using xerces-c v 2.6 to load XML file using DOM during our
>application initialization.
>Our input XML is of size 90 KB.
>
>On target Network Element, our application always segfaults during the
>initialization and we figured out that the crash is exactly at the API
>parseURI(). We are already handling the DOMException, SAXException and
>XMLExceptions. But in this case, none of the exceptions are being
>caught. When we reduced the size of input XML to 19 KB, the segfault was
>not observed. Were there any memory constraints with parseURI() ??
>
>Note that this behavior is observed only on 1 specific NE. The same code
>works on different NE's. How will parseURI behaves if sufficient memory
>is not available to load the XML? Any pointers on how to approach this
>problem will be appreciated.
>
>Thanks,
>Karuna