On Thu, Apr 17, 2008 at 8:12 PM, Brian Johnson <[EMAIL PROTECTED]> wrote:
> The XML parser is probably not threadsafe but is being reused concurrently by 
> multiple post threads resulting in these exceptions.

Hmmm, yes, the factory is reused... here's the code we use to try and
make it thread-safe:

  @Override
  public void init(NamedList args)
  {
    super.init(args);

    inputFactory = BaseXMLInputFactory.newInstance();
    try {
      // The java 1.6 bundled stax parser (sjsxp) does not currently
have a thread-safe
      // XMLInputFactory, as that implementation tries to cache and reuse the
      // XMLStreamReader.  Setting the parser-specific
"reuse-instance" property to false
      // prevents this.
      // All other known open-source stax parsers (and the bea ref impl)
      // have thread-safe factories.
      inputFactory.setProperty("reuse-instance", Boolean.FALSE);
    }
    catch( IllegalArgumentException ex ) {
      // Other implementations will likely throw this exception since
"reuse-instance"
      // isimplementation specific.
      log.fine( "Unable to set the 'reuse-instance' property for the
input factory: "+inputFactory );
    }
  }


Dan: are you sending updates with multiple threads?  If so, can you
just try a single one at a time?

-Yonik



> The observed 'randomness' of the errors would be due to the unpredictable 
> nature of the race condition between threads. The reason you don't see this 
> with smaller documents would be that the likelihood of contention on small 
> documents is reduced because the race is eliminated. This would also be 
> generally independent of JVM, OS, memory allocation, etc as it seems to be.
>
>  I would look into how these classes/methods are dealing with the parser 
> factory. (keeping a static copy maybe?)
>
>
>  
> org.apache.solr.handler.XmlUpdateRequestHandler.processUpdate(XmlUpdateRequestHandler.java:148)
>
> org.apache.solr.handler.XmlUpdateRequestHandler.doLegacyUpdate(XmlUpdateRequestHandler.java:386)
>
> org.apache.solr.servlet.SolrUpdateServlet.doPost(SolrUpdateServlet.java:65)
>
>  This seems to me to be the most likely culprit given what I've seen so far 
> on this thread. I hope it helps.
>
>  -- Brian
>
>
>
>  ----- Original Message ----
>  From: Yonik Seeley <[EMAIL PROTECTED]>
>  To: solr-user@lucene.apache.org
>  Sent: Thursday, April 17, 2008 3:28:08 PM
>  Subject: Re: ODD Solr Error on Update POST - XMLStreamException: ParseError
>
>  On Thu, Apr 17, 2008 at 5:41 PM, realw5 <[EMAIL PROTECTED]> wrote:
>  >  Ok, so I tried tomcat 5.5, still not go. It might be helpful to note, that
>  >  when I decrease the size of the post (take fields out) I can get it to 
> post
>  >  without error. It seems like it's barfing on a certain file size (buffer
>  >  issue maybe??). I'm running 32-bit Ubuntu on our production system and 
> have
>  >  never seen these errors. Is it possible libc has a bug only in 64-bit
>  >  Ubuntu?
>  >
>  >  Lastly, I can try another OS...do you have any recommendations for a good
>  >  64-bit linux flavor?
>
>  Whatever you are comfortable with... if you don't already have
>  something lying around, perhaps the latest ubuntu beta (8.04)
>
>  Also double-check that you are sending exactly what you think you are.
>  If you haven't already, capture the XML you are sending to a file,
>  then use curl (the same version on the same box) to send the file to
>  both the server that works and the one that doesn't.
>
>  -Yonik
>
>
>
>

Reply via email to