You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tamás Cservenák (JIRA)" <ji...@codehaus.org> on 2012/11/16 10:59:13 UTC

[jira] (MINDEXER-63) NullPointerException at org.apache.maven.index.context.DefaultIndexingContext.acquireIndexSearcher

    [ https://jira.codehaus.org/browse/MINDEXER-63?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=313720#comment-313720 ] 

Tamás Cservenák commented on MINDEXER-63:
-----------------------------------------

This stems from concurrent access improperly synchronised. As I see, you use MI 5, and starting with it, the concurrency and synchronisation should be implemented by library consumer.

Here, I _guess_ what happens is that you have (what is suggested by stacktraces in NB bugzilla at least) is that you have concurrent access on context: one update (that will do IndecingContext#replace in one moment during it's execution when _full remote update_ happens) and some search probably ("plain" index read).

This is a known problem with MI (hit us in Nexus too), and Nexus uses following trick from: _never_ perform full remote update, or (as it is now possible with MI) exclusively lock the context being remotely updated. Meaning, you have to ensure no "read" operation happens against it (like searches) in none of the threads.

Also, see MINDEXER-65 as it actually addresses this same problem, with making possible to scan() index _without_ hitting IndexingContext#replace method.
                
> NullPointerException at org.apache.maven.index.context.DefaultIndexingContext.acquireIndexSearcher
> --------------------------------------------------------------------------------------------------
>
>                 Key: MINDEXER-63
>                 URL: https://jira.codehaus.org/browse/MINDEXER-63
>             Project: Maven Indexer
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>         Environment: netbeans 7.3 dev builds.
>            Reporter: Milos Kleint
>            Priority: Critical
>
> see issue http://netbeans.org/bugzilla/show_bug.cgi?id=219645
> for some reason (unknown to me yet) the index files cannot be deleted. The codebase then gets into bad state.
> possibly wrong code in DefaultIndexingContext:
> {code:java}
> public synchronized void replace( Directory directory )
>      throws IOException
>   {
>         final Date ts = IndexUtils.getTimestamp( directory );
>         closeReaders();
>         deleteIndexFiles( false );
>         IndexUtils.copyDirectory( directory, indexDirectory );
>         openAndWarmup();
>         // reclaim the index as mine
>         storeDescriptor();
>         updateTimestamp( true, ts );
>         optimize();
>  }
> {code}
> when deleteIndexFiles(0 fails, openAndWarmup() is not called. also closeReaders() ignores indexWriter..

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