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 Jason Gerlowski <ge...@gmail.com> on 2015/12/23 02:45:48 UTC

Streaming Expressions (/stream) NPE

I'll preface this email by saying that I wasn't sure which mailing list it
belonged on.  It might fit on the dev list (since it involves a potential
Solr bug), but maybe the solr-users list is a better choice (since I'm
probably just misusing Solr).  I settled on the solr-users list.  Sorry if
I chose incorrectly.

Moving on...

I've run into a NullPointerException when trying to use the /stream
handler.  I'm not sure whether I'm doing something wrong with the commands
I'm sending to Solr via curl, or if there's an underlying bug causing this
behavior.

I'm making the stream request:

curl --data-urlencode 'stream=search(gettingstarted, q="*:*",
fl="title,url", sort="_version_ asc", rows="10")'
"localhost:8983/solr/gettingstarted/stream"

Solr responds with:

{"result-set":{"docs":[
{"EXCEPTION":null,"EOF":true}]}}

At this point, I assumed that something was wrong with my command, so I
checked the solr-logs for a hint at the problem.  I found:

ERROR - 2015-12-23 01:32:32.535; [c:gettingstarted s:shard2 r:core_node2
x:gettingstarted_shard2_replica2] org.apache.solr.common.SolrException;
java.lang.NullPointerException
  at
org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.generateStreamExpression(StreamExpressionParser.java:47)
  at
org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.parse(StreamExpressionParser.java:38)
  at
org.apache.solr.client.solrj.io.stream.expr.StreamFactory.constructStream(StreamFactory.java:168)
  at
org.apache.solr.handler.StreamHandler.handleRequestBody(StreamHandler.java:155)
  at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)

Has anyone seen this behavior before?  Is Solr reacting to something amiss
in my request, or is there maybe a bug here?  I'll admit this is my first
attempt at using the /stream API, so I might be getting something wrong
here.  I consulted the reference guide's examples on using the streaming
API (https://cwiki.apache.org/confluence/display/solr/Streaming+Expressions)
when coming up with my curl command, but I might've missed something.

Anyways, I'd appreciate any insight that anyone can offer on this.  If it
helps, I've included reproduction steps below.

1.) Download and compile Solr trunk.
2.) Start Solr using one of the examples (bin/solr start -e cloud).  Accept
default values.
3.) Index some docs (bin/post -c gettingstarted
http://lucene.apache.org/solr -recursive 1 -delay 1)
4.) Do a search to sanity check the ingestion (curl
"localhost:8983/solr/gettingstarted/select?q=*:*&wt=json")
5.) Make a /stream request for some docs (curl --data-urlencode
'stream=search(gettingstarted, q="*:*", fl="title,url", sort="_version_
asc", rows="10")' "localhost:8983/solr/gettingstarted/stream")

Thanks again for any ideas/help anyone can give.

Best,

Jason

Re: Streaming Expressions (/stream) NPE

Posted by Joel Bernstein <jo...@gmail.com>.
Thanks for the feedback. Yes, please create the ticket. I believe all that
needs to be done is to check for null and then throw a better exception.

Joel Bernstein
http://joelsolr.blogspot.com/

On Wed, Dec 23, 2015 at 9:15 AM, Jason Gerlowski <ge...@gmail.com>
wrote:

> Thanks for the heads up Joel.  Glad this was just user error, and not an
> actual problem.
>
> Though it is interesting that Solr's response didn't contain any
> information about what was wrong.  I probably would've expected a message
> to the effect of: "the required parameter 'expr' was not found".
>
> Also, it was a little disappointing that when the thrown exception has no
> message, ExceptionStream puts 'null' in the EXCEPTION Tuple (i.e.
> {"EXCEPTION":null,"EOF":true}).  It might be nice if the name/type of the
> exception was used when no message can be found.
>
> I'd be happy to create JIRAs and push up a patch for one/both of those
> behaviors if people agree that this would make the API a little nicer.
>
> Thanks again Joel.
>
> Best,
>
> Jason
>
> On Tue, Dec 22, 2015 at 10:06 PM, Joel Bernstein <jo...@gmail.com>
> wrote:
>
> > The http parameter "stream" was recently changed to "expr" in SOLR-8443.
> >
> > Joel Bernstein
> > http://joelsolr.blogspot.com/
> >
> > On Tue, Dec 22, 2015 at 8:45 PM, Jason Gerlowski <ge...@gmail.com>
> > wrote:
> >
> > > I'll preface this email by saying that I wasn't sure which mailing list
> > it
> > > belonged on.  It might fit on the dev list (since it involves a
> potential
> > > Solr bug), but maybe the solr-users list is a better choice (since I'm
> > > probably just misusing Solr).  I settled on the solr-users list.  Sorry
> > if
> > > I chose incorrectly.
> > >
> > > Moving on...
> > >
> > > I've run into a NullPointerException when trying to use the /stream
> > > handler.  I'm not sure whether I'm doing something wrong with the
> > commands
> > > I'm sending to Solr via curl, or if there's an underlying bug causing
> > this
> > > behavior.
> > >
> > > I'm making the stream request:
> > >
> > > curl --data-urlencode 'stream=search(gettingstarted, q="*:*",
> > > fl="title,url", sort="_version_ asc", rows="10")'
> > > "localhost:8983/solr/gettingstarted/stream"
> > >
> > > Solr responds with:
> > >
> > > {"result-set":{"docs":[
> > > {"EXCEPTION":null,"EOF":true}]}}
> > >
> > > At this point, I assumed that something was wrong with my command, so I
> > > checked the solr-logs for a hint at the problem.  I found:
> > >
> > > ERROR - 2015-12-23 01:32:32.535; [c:gettingstarted s:shard2
> r:core_node2
> > > x:gettingstarted_shard2_replica2] org.apache.solr.common.SolrException;
> > > java.lang.NullPointerException
> > >   at
> > >
> > >
> >
> org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.generateStreamExpression(StreamExpressionParser.java:47)
> > >   at
> > >
> > >
> >
> org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.parse(StreamExpressionParser.java:38)
> > >   at
> > >
> > >
> >
> org.apache.solr.client.solrj.io.stream.expr.StreamFactory.constructStream(StreamFactory.java:168)
> > >   at
> > >
> > >
> >
> org.apache.solr.handler.StreamHandler.handleRequestBody(StreamHandler.java:155)
> > >   at
> > >
> > >
> >
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)
> > >
> > > Has anyone seen this behavior before?  Is Solr reacting to something
> > amiss
> > > in my request, or is there maybe a bug here?  I'll admit this is my
> first
> > > attempt at using the /stream API, so I might be getting something wrong
> > > here.  I consulted the reference guide's examples on using the
> streaming
> > > API (
> > > https://cwiki.apache.org/confluence/display/solr/Streaming+Expressions
> )
> > > when coming up with my curl command, but I might've missed something.
> > >
> > > Anyways, I'd appreciate any insight that anyone can offer on this.  If
> it
> > > helps, I've included reproduction steps below.
> > >
> > > 1.) Download and compile Solr trunk.
> > > 2.) Start Solr using one of the examples (bin/solr start -e cloud).
> > Accept
> > > default values.
> > > 3.) Index some docs (bin/post -c gettingstarted
> > > http://lucene.apache.org/solr -recursive 1 -delay 1)
> > > 4.) Do a search to sanity check the ingestion (curl
> > > "localhost:8983/solr/gettingstarted/select?q=*:*&wt=json")
> > > 5.) Make a /stream request for some docs (curl --data-urlencode
> > > 'stream=search(gettingstarted, q="*:*", fl="title,url", sort="_version_
> > > asc", rows="10")' "localhost:8983/solr/gettingstarted/stream")
> > >
> > > Thanks again for any ideas/help anyone can give.
> > >
> > > Best,
> > >
> > > Jason
> > >
> >
>

Re: Streaming Expressions (/stream) NPE

Posted by Jason Gerlowski <ge...@gmail.com>.
Thanks for the heads up Joel.  Glad this was just user error, and not an
actual problem.

Though it is interesting that Solr's response didn't contain any
information about what was wrong.  I probably would've expected a message
to the effect of: "the required parameter 'expr' was not found".

Also, it was a little disappointing that when the thrown exception has no
message, ExceptionStream puts 'null' in the EXCEPTION Tuple (i.e.
{"EXCEPTION":null,"EOF":true}).  It might be nice if the name/type of the
exception was used when no message can be found.

I'd be happy to create JIRAs and push up a patch for one/both of those
behaviors if people agree that this would make the API a little nicer.

Thanks again Joel.

Best,

Jason

On Tue, Dec 22, 2015 at 10:06 PM, Joel Bernstein <jo...@gmail.com> wrote:

> The http parameter "stream" was recently changed to "expr" in SOLR-8443.
>
> Joel Bernstein
> http://joelsolr.blogspot.com/
>
> On Tue, Dec 22, 2015 at 8:45 PM, Jason Gerlowski <ge...@gmail.com>
> wrote:
>
> > I'll preface this email by saying that I wasn't sure which mailing list
> it
> > belonged on.  It might fit on the dev list (since it involves a potential
> > Solr bug), but maybe the solr-users list is a better choice (since I'm
> > probably just misusing Solr).  I settled on the solr-users list.  Sorry
> if
> > I chose incorrectly.
> >
> > Moving on...
> >
> > I've run into a NullPointerException when trying to use the /stream
> > handler.  I'm not sure whether I'm doing something wrong with the
> commands
> > I'm sending to Solr via curl, or if there's an underlying bug causing
> this
> > behavior.
> >
> > I'm making the stream request:
> >
> > curl --data-urlencode 'stream=search(gettingstarted, q="*:*",
> > fl="title,url", sort="_version_ asc", rows="10")'
> > "localhost:8983/solr/gettingstarted/stream"
> >
> > Solr responds with:
> >
> > {"result-set":{"docs":[
> > {"EXCEPTION":null,"EOF":true}]}}
> >
> > At this point, I assumed that something was wrong with my command, so I
> > checked the solr-logs for a hint at the problem.  I found:
> >
> > ERROR - 2015-12-23 01:32:32.535; [c:gettingstarted s:shard2 r:core_node2
> > x:gettingstarted_shard2_replica2] org.apache.solr.common.SolrException;
> > java.lang.NullPointerException
> >   at
> >
> >
> org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.generateStreamExpression(StreamExpressionParser.java:47)
> >   at
> >
> >
> org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.parse(StreamExpressionParser.java:38)
> >   at
> >
> >
> org.apache.solr.client.solrj.io.stream.expr.StreamFactory.constructStream(StreamFactory.java:168)
> >   at
> >
> >
> org.apache.solr.handler.StreamHandler.handleRequestBody(StreamHandler.java:155)
> >   at
> >
> >
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)
> >
> > Has anyone seen this behavior before?  Is Solr reacting to something
> amiss
> > in my request, or is there maybe a bug here?  I'll admit this is my first
> > attempt at using the /stream API, so I might be getting something wrong
> > here.  I consulted the reference guide's examples on using the streaming
> > API (
> > https://cwiki.apache.org/confluence/display/solr/Streaming+Expressions)
> > when coming up with my curl command, but I might've missed something.
> >
> > Anyways, I'd appreciate any insight that anyone can offer on this.  If it
> > helps, I've included reproduction steps below.
> >
> > 1.) Download and compile Solr trunk.
> > 2.) Start Solr using one of the examples (bin/solr start -e cloud).
> Accept
> > default values.
> > 3.) Index some docs (bin/post -c gettingstarted
> > http://lucene.apache.org/solr -recursive 1 -delay 1)
> > 4.) Do a search to sanity check the ingestion (curl
> > "localhost:8983/solr/gettingstarted/select?q=*:*&wt=json")
> > 5.) Make a /stream request for some docs (curl --data-urlencode
> > 'stream=search(gettingstarted, q="*:*", fl="title,url", sort="_version_
> > asc", rows="10")' "localhost:8983/solr/gettingstarted/stream")
> >
> > Thanks again for any ideas/help anyone can give.
> >
> > Best,
> >
> > Jason
> >
>

Re: Streaming Expressions (/stream) NPE

Posted by Joel Bernstein <jo...@gmail.com>.
The http parameter "stream" was recently changed to "expr" in SOLR-8443.

Joel Bernstein
http://joelsolr.blogspot.com/

On Tue, Dec 22, 2015 at 8:45 PM, Jason Gerlowski <ge...@gmail.com>
wrote:

> I'll preface this email by saying that I wasn't sure which mailing list it
> belonged on.  It might fit on the dev list (since it involves a potential
> Solr bug), but maybe the solr-users list is a better choice (since I'm
> probably just misusing Solr).  I settled on the solr-users list.  Sorry if
> I chose incorrectly.
>
> Moving on...
>
> I've run into a NullPointerException when trying to use the /stream
> handler.  I'm not sure whether I'm doing something wrong with the commands
> I'm sending to Solr via curl, or if there's an underlying bug causing this
> behavior.
>
> I'm making the stream request:
>
> curl --data-urlencode 'stream=search(gettingstarted, q="*:*",
> fl="title,url", sort="_version_ asc", rows="10")'
> "localhost:8983/solr/gettingstarted/stream"
>
> Solr responds with:
>
> {"result-set":{"docs":[
> {"EXCEPTION":null,"EOF":true}]}}
>
> At this point, I assumed that something was wrong with my command, so I
> checked the solr-logs for a hint at the problem.  I found:
>
> ERROR - 2015-12-23 01:32:32.535; [c:gettingstarted s:shard2 r:core_node2
> x:gettingstarted_shard2_replica2] org.apache.solr.common.SolrException;
> java.lang.NullPointerException
>   at
>
> org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.generateStreamExpression(StreamExpressionParser.java:47)
>   at
>
> org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser.parse(StreamExpressionParser.java:38)
>   at
>
> org.apache.solr.client.solrj.io.stream.expr.StreamFactory.constructStream(StreamFactory.java:168)
>   at
>
> org.apache.solr.handler.StreamHandler.handleRequestBody(StreamHandler.java:155)
>   at
>
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:156)
>
> Has anyone seen this behavior before?  Is Solr reacting to something amiss
> in my request, or is there maybe a bug here?  I'll admit this is my first
> attempt at using the /stream API, so I might be getting something wrong
> here.  I consulted the reference guide's examples on using the streaming
> API (
> https://cwiki.apache.org/confluence/display/solr/Streaming+Expressions)
> when coming up with my curl command, but I might've missed something.
>
> Anyways, I'd appreciate any insight that anyone can offer on this.  If it
> helps, I've included reproduction steps below.
>
> 1.) Download and compile Solr trunk.
> 2.) Start Solr using one of the examples (bin/solr start -e cloud).  Accept
> default values.
> 3.) Index some docs (bin/post -c gettingstarted
> http://lucene.apache.org/solr -recursive 1 -delay 1)
> 4.) Do a search to sanity check the ingestion (curl
> "localhost:8983/solr/gettingstarted/select?q=*:*&wt=json")
> 5.) Make a /stream request for some docs (curl --data-urlencode
> 'stream=search(gettingstarted, q="*:*", fl="title,url", sort="_version_
> asc", rows="10")' "localhost:8983/solr/gettingstarted/stream")
>
> Thanks again for any ideas/help anyone can give.
>
> Best,
>
> Jason
>