You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (Commented) (JIRA)" <ji...@apache.org> on 2012/02/20 02:00:56 UTC

[jira] [Commented] (LUCENE-3803) Using a searcher with an executor service does not work from within a Callable called by that same executor service

    [ https://issues.apache.org/jira/browse/LUCENE-3803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13211622#comment-13211622 ] 

Uwe Schindler commented on LUCENE-3803:
---------------------------------------

The problem is that you are using the same fixed thread pool for everything. If you only have 1 or 2 threads in the pool (as noted in your mail) and one of those threads calls searcher.search() from within its own callable, searcher.search will try to execute the sub-searches in its own callables. If the thread pool does not have enough free threads, it will wait for a thread to get available (because another callable finishes). The callable that called searcher.search will of course not finish as it waits for itsself to finish -> deadlock.

The bad idea with thread pools that leads to your problem is: Don't start Callables from within another Callable in the same thread pool. This almost always leads to deadlocks.
                
> Using a searcher with an executor service does not work from within a Callable called by that same executor service
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3803
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3803
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/search
>    Affects Versions: 3.5
>            Reporter: Benson Margulies
>         Attachments: lucene-tc.tgz
>
>
> The test case I'm about to attach creates an executor service uses invokeAll to run things from it. The 'things' (Callable) that it runs in turn run Lucene searchers using a searcher that has the very same executor service. This turns out to hit some sort of deadlock related to the executor service queue. 
> I won't be terribly surprised if this is really a matter of a fundamental limitation of the executor service, but if nothing else this JIRA might provoke a warning in the javadoc. Or, what do I know, maybe there's a way Lucene could interact with the executor service that gets along with this?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org