You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Shawn Heisey <so...@elyograg.org> on 2012/11/06 08:25:20 UTC

Problem with ping handler, SolrJ 4.1-SNAPSHOT, Solr 3.5.0

If I send a ping request to Solr 4.1 from SolrJ 4.1, it works.  I don't 
have an exact revision number from branch_4x, I don't know how to get it 
from SolrJ.  The 4.1 server is running solr-impl 4.1-SNAPSHOT 1401798M 
with the patch from SOLR-1972 applied, and it's somewhat newer than SolrJ.


Java code snippets:

private static final String PING_HANDLER = "/admin/ping";

query.setRequestHandler(PING_HANDLER);
response = _querySolr.query(query);


If I use this exact same code to talk to a Solr 3.5.0 server (older 
version of the SOLR-1972 patch applied) with the ping handler in the 
"enabled" state, I get the following exception.  The /admin/ping handler 
works in a browser on both Solr versions:

Caused by: org.apache.solr.client.solrj.SolrServerException: Error 
executing query
     at 
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:98)
     at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
     at com.newscom.common.solr.Core.ping(Core.java:396)
     ... 4 more
Caused by: java.lang.RuntimeException: Invalid version (expected 2, but 
60) or the data in not in 'javabin' format
     at 
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:109)
     at 
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:384)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
     at 
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
     ... 6 more

If I use the XMLResponseParser instead, then I get a different exception:

Caused by: org.apache.solr.common.SolrException: parsing error
     at 
org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:143)
     at 
org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:104)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:384)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
     at 
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
     at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
     at com.newscom.common.solr.Core.ping(Core.java:398)
     ... 4 more
Caused by: java.lang.Exception: really needs to be response or result.  
not:html
     at 
org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:134)
     ... 10 more

I'm already dealing with the expected "Service Unavailable" exception, 
this is something different.  Is it going to be possible to make this 
work?  Should I file an issue in Jira?  Is the problem in the newer 
SolrJ or in the older Solr?  At this time I do not really need the 
information in the response, I just need to be able to judge success 
(Solr is up and working) by nothing being thrown, and be able to look 
into any exception thrown to see whether I've got a disabled handler or 
an error condition.

Thanks,
Shawn


Re: Problem with ping handler, SolrJ 4.1-SNAPSHOT, Solr 3.5.0

Posted by Shawn Heisey <so...@elyograg.org>.
On 11/6/2012 12:25 AM, Shawn Heisey wrote:
> If I use this exact same code to talk to a Solr 3.5.0 server (older 
> version of the SOLR-1972 patch applied) with the ping handler in the 
> "enabled" state, I get the following exception.  The /admin/ping 
> handler works in a browser on both Solr versions:
>
> Caused by: org.apache.solr.client.solrj.SolrServerException: Error 
> executing query
>     at 
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:98)
>     at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
>     at com.newscom.common.solr.Core.ping(Core.java:396)
>     ... 4 more
> Caused by: java.lang.RuntimeException: Invalid version (expected 2, 
> but 60) or the data in not in 'javabin' format
>     at 
> org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:109)
>     at 
> org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)
>     at 
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:384)
>     at 
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
>     at 
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
>     ... 6 more

No response in two days.  See original message for full details.

I grabbed the javabin response on 4.1-SNAPSHOT and on 3.5.0. Aside from 
the 4.1 version having a lot more data, I couldn't see a lot of 
difference between the two (examining in notepad, not a binary editor), 
but as I am unfamiliar with the javabin format, I cannot say.

My best guess at this point is that something in the 3.5.0 response, or 
the http headers sent with the response, makes SolrJ barf.

Right now I am treating an exception that contains the "Invalid version" 
message as a "no info" status.  With the 4.1-SNAPSHOT server, I can 
reliably say "OK" instead.  With both versions, I can detect the 
"Disabled" state.

Unless someone objects, I will be filing a bug against 3.5, though a 
workaround in the newer SolrJ would be welcome as well.

Thanks,
Shawn


Re: Problem with ping handler, SolrJ 4.1-SNAPSHOT, Solr 3.5.0

Posted by Shawn Heisey <so...@elyograg.org>.
On 11/8/2012 3:25 PM, Dyer, James wrote:
> Shawn,
>
> Could this be a side-effect from SOLR-4019, in branch_4.0 this was commit r1405894 ?  Prior to this commit, PingRequestHandler would throw a SolrException for 503/Bad Request.  The change is that the exception isn't actually thrown but rather sent in place of the response.  This prevents the container from logging huge stack traces just because PingrequestHandler is in a "disabled" state.  Prior to this, SolrException had logging disabled for 503's with hardcoding, but this broke other uses of 503 SE's.
My checkout of branch_4x is prior to the change from SOLR-4019. SolrJ is 
considerably older, Solr is somewhat newer.  I'm having a problem with 
3.5.0 servers, not 4.x.

I'm already handling the exception when the ping handler is disabled and 
returns a 503 error.  The exception message is different between the two 
versions, but I'm dealing with that.  My problem happens when the ping 
handler is enabled.  Against a 4.1-SNAPSHOT server, I successfully get a 
QueryResponse object from the query.  Against a 3.5.0 server, I get an 
exception, with this as the relevant piece:

Caused by: java.lang.RuntimeException: Invalid version (expected 2, but 
60) or the data in not in 'javabin' format
         at 
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:109)

In a browser, using /solr/CORE/admin/ping gets me an XML response.  For 
both versions, in the main response section is a status field saying OK, 
and in the responseHeader section is a status field with a value of zero.

I have not tried a SolrJ 3.5 against the 3.5 server.  This program is 
generating a status page for my entire Solr environment, both 3.5 
production and 4.1 development, I can't run two versions.

Thanks,
Shawn


Re: Problem with ping handler, SolrJ 4.1-SNAPSHOT, Solr 3.5.0

Posted by Shawn Heisey <so...@elyograg.org>.
On 11/8/2012 3:25 PM, Dyer, James wrote:
> Could this be a side-effect from SOLR-4019, in branch_4.0 this was commit r1405894 ?  Prior to this commit, PingRequestHandler would throw a SolrException for 503/Bad Request.  The change is that the exception isn't actually thrown but rather sent in place of the response.  This prevents the container from logging huge stack traces just because PingrequestHandler is in a "disabled" state.  Prior to this, SolrException had logging disabled for 503's with hardcoding, but this broke other uses of 503 SE's.

While working on another issue (SOLR-4143), I figured out why this isn't 
working.  Initially I did not connect the exceptions in the Solr 3.5 log 
to my problems getting ping responses, but the light eventually turned on.

My requests to the 3.5 ping handler from SolrJ 4.1-SNAPSHOT use the 
setRequestHandler method to talk to /admin/ping.  In addition to using 
/admin/ping as the URL path, this also sets the qt parameter to 
/admin/ping.  The PingRequestHandler in Solr 3.x looks at the qt 
parameter that it receives, and if that handler is an instance of 
PingRequestHandler, throws an exception saying that you can't call PRH 
recursively.  This is why I get an exception and no response, but it 
works perfectly in a browser -- I wasn't setting qt in my browser.  Once 
I did that, I get the bad response in the browser too.

There is no way in SolrJ 4.x or trunk to set the request handler without 
also setting qt.  When I looked at SolrJ code trying to make a patch for 
SOLR-4143, I discovered that it's not a trivial change, and it may not 
be possible to even do in branch_4x.

Is there possibly a workaround I can use in SolrJ?  Other thoughts?

Thanks,
Shawn


RE: Problem with ping handler, SolrJ 4.1-SNAPSHOT, Solr 3.5.0

Posted by "Dyer, James" <Ja...@ingramcontent.com>.
Shawn,

Could this be a side-effect from SOLR-4019, in branch_4.0 this was commit r1405894 ?  Prior to this commit, PingRequestHandler would throw a SolrException for 503/Bad Request.  The change is that the exception isn't actually thrown but rather sent in place of the response.  This prevents the container from logging huge stack traces just because PingrequestHandler is in a "disabled" state.  Prior to this, SolrException had logging disabled for 503's with hardcoding, but this broke other uses of 503 SE's.

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: Shawn Heisey [mailto:solr@elyograg.org] 
Sent: Tuesday, November 06, 2012 1:25 AM
To: solr-user@lucene.apache.org
Subject: Problem with ping handler, SolrJ 4.1-SNAPSHOT, Solr 3.5.0

If I send a ping request to Solr 4.1 from SolrJ 4.1, it works.  I don't 
have an exact revision number from branch_4x, I don't know how to get it 
from SolrJ.  The 4.1 server is running solr-impl 4.1-SNAPSHOT 1401798M 
with the patch from SOLR-1972 applied, and it's somewhat newer than SolrJ.


Java code snippets:

private static final String PING_HANDLER = "/admin/ping";

query.setRequestHandler(PING_HANDLER);
response = _querySolr.query(query);


If I use this exact same code to talk to a Solr 3.5.0 server (older 
version of the SOLR-1972 patch applied) with the ping handler in the 
"enabled" state, I get the following exception.  The /admin/ping handler 
works in a browser on both Solr versions:

Caused by: org.apache.solr.client.solrj.SolrServerException: Error 
executing query
     at 
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:98)
     at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
     at com.newscom.common.solr.Core.ping(Core.java:396)
     ... 4 more
Caused by: java.lang.RuntimeException: Invalid version (expected 2, but 
60) or the data in not in 'javabin' format
     at 
org.apache.solr.common.util.JavaBinCodec.unmarshal(JavaBinCodec.java:109)
     at 
org.apache.solr.client.solrj.impl.BinaryResponseParser.processResponse(BinaryResponseParser.java:41)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:384)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
     at 
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
     ... 6 more

If I use the XMLResponseParser instead, then I get a different exception:

Caused by: org.apache.solr.common.SolrException: parsing error
     at 
org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:143)
     at 
org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:104)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:384)
     at 
org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
     at 
org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
     at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
     at com.newscom.common.solr.Core.ping(Core.java:398)
     ... 4 more
Caused by: java.lang.Exception: really needs to be response or result.  
not:html
     at 
org.apache.solr.client.solrj.impl.XMLResponseParser.processResponse(XMLResponseParser.java:134)
     ... 10 more

I'm already dealing with the expected "Service Unavailable" exception, 
this is something different.  Is it going to be possible to make this 
work?  Should I file an issue in Jira?  Is the problem in the newer 
SolrJ or in the older Solr?  At this time I do not really need the 
information in the response, I just need to be able to judge success 
(Solr is up and working) by nothing being thrown, and be able to look 
into any exception thrown to see whether I've got a disabled handler or 
an error condition.

Thanks,
Shawn