solr-1.2.0 java.util.concurrent.RejectedExecutionException

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

solr-1.2.0 java.util.concurrent.RejectedExecutionException

Karen Loughran

Hi all,

I have downloaded the latest Solr and have created a solr utility jar based on
EmbeddedSolr from the wiki, (http://wiki.apache.org/solr/SolJava).

My jar has a search method which basically gets the solr core and
calls "searchSolr" (identical to that in EmbeddedSolr) with the passed in
string and closes the core before exiting the method.

When I make two subsequent calls to my search method from a client program I
get the following exception on the 2nd attempt:


29-Jun-2007 13:51:50 org.apache.solr.search.SolrIndexSearcher <init>
INFO: Opening Searcher@1efb4be main
29-Jun-2007 13:51:50 org.apache.solr.core.SolrException log
SEVERE: java.util.concurrent.RejectedExecutionException
    at
java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1759)
    at
java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
    at
java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658)
    at
java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:92)
    at
java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:603)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:536)
    at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:324)
    at
org.apache.solr.request.SolrQueryRequestBase.getSearcher(SolrQueryRequestBase.java:173)
    at
org.apache.solr.request.StandardRequestHandler.handleRequestBody(StandardRequestHandler.java:114)
    at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:77)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:658)
    at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown Source)
    at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown Source)
    at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchStarts(Unknown
Source)
    at
uk.ac.besc.prism.searcher.client.TestSearchDirect.main(TestSearchDirect.java:47)


By the way, EmbeddedSolr as provided works fine, no such exception.
I also tried putting a sleep for 5 seconds in case the core had not properly
closed before I tried opening it again (through the 2nd call to search).

I noticed a discussion in February about the RejectedExecutionException, but
its not clear to me whether there was a resolution to it ?
http://www.mail-archive.com/solr-dev@.../msg02822.html

Can anyone tell me what is causing this and how I can work around it ?

Many thanks

Karen Loughran



Reply | Threaded
Open this post in threaded view
|

Re: solr-1.2.0 java.util.concurrent.RejectedExecutionException

Yonik Seeley-2
On 6/29/07, Karen Loughran <[hidden email]> wrote:

>
> Hi all,
>
> I have downloaded the latest Solr and have created a solr utility jar based on
> EmbeddedSolr from the wiki, (http://wiki.apache.org/solr/SolJava).
>
> My jar has a search method which basically gets the solr core and
> calls "searchSolr" (identical to that in EmbeddedSolr) with the passed in
> string and closes the core before exiting the method.
>
> When I make two subsequent calls to my search method from a client program I
> get the following exception on the 2nd attempt:

Yes, because the SolrCore (currently a static singleton) has been closed.
In your search method, don't call close() on the core... it should
hang around for the lifetime of your application.

-Yonik


> 29-Jun-2007 13:51:50 org.apache.solr.search.SolrIndexSearcher <init>
> INFO: Opening Searcher@1efb4be main
> 29-Jun-2007 13:51:50 org.apache.solr.core.SolrException log
> SEVERE: java.util.concurrent.RejectedExecutionException
>     at
> java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1759)
>     at
> java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:767)
>     at
> java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:658)
>     at
> java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:92)
>     at
> java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.java:603)
>     at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:536)
>     at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:324)
>     at
> org.apache.solr.request.SolrQueryRequestBase.getSearcher(SolrQueryRequestBase.java:173)
>     at
> org.apache.solr.request.StandardRequestHandler.handleRequestBody(StandardRequestHandler.java:114)
>     at
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:77)
>     at org.apache.solr.core.SolrCore.execute(SolrCore.java:658)
>     at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown Source)
>     at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown Source)
>     at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchStarts(Unknown
> Source)
>     at
> uk.ac.besc.prism.searcher.client.TestSearchDirect.main(TestSearchDirect.java:47)
>
>
> By the way, EmbeddedSolr as provided works fine, no such exception.
> I also tried putting a sleep for 5 seconds in case the core had not properly
> closed before I tried opening it again (through the 2nd call to search).
>
> I noticed a discussion in February about the RejectedExecutionException, but
> its not clear to me whether there was a resolution to it ?
> http://www.mail-archive.com/solr-dev@.../msg02822.html
>
> Can anyone tell me what is causing this and how I can work around it ?
>
> Many thanks
>
> Karen Loughran
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: solr-1.2.0 java.util.concurrent.RejectedExecutionException

Karen Loughran


Yonik, Thanks for your reply,

I originally had implemented it as you suggest, ie, opened the core in a
static initialiser and never closed it, but my client hangs - AFTER receiving
the response back from solr (and after response from my utility jar).

I have now changed back to this approach, but... I have to put
a "System.exit(0)" at the end of my client code so that it can terminate.  
Seems like there may be a thread still hanging around preventing my client
from exiting.  Could this be to do with the ExecutorService using the default
thread factory which will create non-daemon threads ?

My utility jar is a standalone java library (not a webservice).

Many thanks,

Karen



On Friday 29 June 2007 15:00:49 Yonik Seeley wrote:

> On 6/29/07, Karen Loughran <[hidden email]> wrote:
> > Hi all,
> >
> > I have downloaded the latest Solr and have created a solr utility jar
> > based on EmbeddedSolr from the wiki,
> > (http://wiki.apache.org/solr/SolJava).
> >
> > My jar has a search method which basically gets the solr core and
> > calls "searchSolr" (identical to that in EmbeddedSolr) with the passed in
> > string and closes the core before exiting the method.
> >
> > When I make two subsequent calls to my search method from a client
> > program I get the following exception on the 2nd attempt:
>
> Yes, because the SolrCore (currently a static singleton) has been closed.
> In your search method, don't call close() on the core... it should
> hang around for the lifetime of your application.
>
> -Yonik
>
> > 29-Jun-2007 13:51:50 org.apache.solr.search.SolrIndexSearcher <init>
> > INFO: Opening Searcher@1efb4be main
> > 29-Jun-2007 13:51:50 org.apache.solr.core.SolrException log
> > SEVERE: java.util.concurrent.RejectedExecutionException
> >     at
> > java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(Thr
> >eadPoolExecutor.java:1759) at
> > java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:76
> >7) at
> > java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:6
> >58) at
> > java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorServi
> >ce.java:92) at
> > java.util.concurrent.Executors$DelegatedExecutorService.submit(Executors.
> >java:603) at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:536)
> > at org.apache.solr.core.SolrCore.getSearcher(SolrCore.java:324) at
> > org.apache.solr.request.SolrQueryRequestBase.getSearcher(SolrQueryRequest
> >Base.java:173) at
> > org.apache.solr.request.StandardRequestHandler.handleRequestBody(Standard
> >RequestHandler.java:114) at
> > org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBa
> >se.java:77) at org.apache.solr.core.SolrCore.execute(SolrCore.java:658)
> >     at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown
> > Source) at uk.ac.besc.prism.searcher.impl.SolrSearcher.searchSolr(Unknown
> > Source) at
> > uk.ac.besc.prism.searcher.impl.SolrSearcher.searchStarts(Unknown Source)
> >     at
> > uk.ac.besc.prism.searcher.client.TestSearchDirect.main(TestSearchDirect.j
> >ava:47)
> >
> >
> > By the way, EmbeddedSolr as provided works fine, no such exception.
> > I also tried putting a sleep for 5 seconds in case the core had not
> > properly closed before I tried opening it again (through the 2nd call to
> > search).
> >
> > I noticed a discussion in February about the RejectedExecutionException,
> > but its not clear to me whether there was a resolution to it ?
> > http://www.mail-archive.com/solr-dev@.../msg02822.html
> >
> > Can anyone tell me what is causing this and how I can work around it ?
> >
> > Many thanks
> >
> > Karen Loughran


Reply | Threaded
Open this post in threaded view
|

Re: solr-1.2.0 java.util.concurrent.RejectedExecutionException

Yonik Seeley-2
On 6/29/07, Karen Loughran <[hidden email]> wrote:

> Yonik, Thanks for your reply,
>
> I originally had implemented it as you suggest, ie, opened the core in a
> static initialiser and never closed it, but my client hangs - AFTER receiving
> the response back from solr (and after response from my utility jar).
>
> I have now changed back to this approach, but... I have to put
> a "System.exit(0)" at the end of my client code so that it can terminate.
> Seems like there may be a thread still hanging around preventing my client
> from exiting.  Could this be to do with the ExecutorService using the default
> thread factory which will create non-daemon threads ?

Yes, that's is most likely it.

-Yonik