org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/app/nexus-testing/2.3.1-01/nexus-professional-2.3.1-01-bundle-2/sonatype-work/nexus/indexer/hosted-1-ctx/write.lock

Sonatype JIRA | Peter Lynch | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    1) Unpack Nexus with default config and start it 2) Execute the attached JMeter binary using {{jmeter/bin/jmeter}} 3) open and run the attached plan file. The test plan creates a hosted repo, adds it to a group, removes it from a group and deletes the original repo repeatedly for 10 seconds. This can corrupt the search indexes and running repair index task will not recover it. If a keyword search is performed, it can return 500 status from Nexus. Selecting a node in browse storage for an existing artifact ( if you download one before running test ) can cause 500 error in UI. The only recovery for search seems to be to stop nexus, delete the indexer directory and run a publish indexes task on all repos to regenerate the indexes. In one case, I noticed an indexer/hosted-1-ctx directory failed to be created but the storage repo does. When publish indexes task is run in this case, it fails since hosted-1-ctx directory does not exist and lock cannot be obtained. Examples: {noformat} jvm 1 | 2013-04-14 22:06:08 ERROR [tp1113757163-71] - org.sonatype.nexus.events.IndexingRepositoryRegistryRepositoryEventInspector - Could not maintain indexing contexts! jvm 1 | org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/app/nexus-testing/2.3.1-01/nexus-professional-2.3.1-01-bundle-2/sonatype-work/nexus/indexer/hosted-1-ctx/write.lock jvm 1 | at org.apache.lucene.store.Lock.obtain(Lock.java:84) ~[lucene-core-3.6.1.jar:3.6.1 1362471 - thetaphi - 2012-07-17 12:40:12] jvm 1 | at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1098) ~[lucene-core-3.6.1.jar:3.6.1 1362471 - thetaphi - 2012-07-17 12:40:12] jvm 1 | at org.apache.maven.index.context.NexusIndexWriter.<init>(NexusIndexWriter.java:53) ~[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3] jvm 1 | at org.apache.maven.index.context.DefaultIndexingContext.openAndWarmup(DefaultIndexingContext.java:473) ~[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3] jvm 1 | at org.apache.maven.index.context.DefaultIndexingContext.prepareCleanIndex(DefaultIndexingContext.java:238) ~[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3] jvm 1 | at org.apache.maven.index.context.DefaultIndexingContext.prepareIndex(DefaultIndexingContext.java:216) ~[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3] jvm 1 | at org.apache.maven.index.context.DefaultIndexingContext.<init>(DefaultIndexingContext.java:147) ~[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3] jvm 1 | at org.apache.maven.index.context.DefaultIndexingContext.<init>(DefaultIndexingContext.java:167) ~[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3] jvm 1 | at org.sonatype.nexus.index.NexusIndexingContext.<init>(NexusIndexingContext.java:45) ~[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.addRepositoryIndexContext(DefaultIndexerManager.java:465) ~[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.access$000(DefaultIndexerManager.java:186) ~[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager$1.run(DefaultIndexerManager.java:430) ~[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.exclusiveSingle(DefaultIndexerManager.java:2538) ~[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.addRepositoryIndexContext(DefaultIndexerManager.java:424) ~[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.addRepositoryIndexContext(DefaultIndexerManager.java:402) ~[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.events.IndexingRepositoryRegistryRepositoryEventInspector.inspectForIndexerManager(IndexingRepositoryRegistryRepositoryEventInspector.java:96) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.events.IndexingRepositoryRegistryRepositoryEventInspector.inspect(IndexingRepositoryRegistryRepositoryEventInspector.java:81) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.events.DefaultEventInspectorHost.processEvent(DefaultEventInspectorHost.java:131) [nexus-app-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.events.DefaultEventInspectorHost.onEvent(DefaultEventInspectorHost.java:104) [nexus-app-2.3.1-01.jar:2.3.1-01] jvm {noformat} {noformat} jvm 1 | 2013-04-14 22:08:34 WARN [ool-1-thread-20] - org.sonatype.nexus.index.DefaultIndexerManager - Could not perform index operation on repository hosted-1 jvm 1 | java.lang.Exception: null jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager$18.run(DefaultIndexerManager.java:2483) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.exclusiveSingle(DefaultIndexerManager.java:2538) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.temporary(DefaultIndexerManager.java:2466) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.reindexRepository(DefaultIndexerManager.java:1044) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.index.DefaultIndexerManager.reindexAllRepositories(DefaultIndexerManager.java:915) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.tasks.ReindexTaskHandlerLegacy.reindexAllRepositories(ReindexTaskHandlerLegacy.java:41) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.tasks.AbstractIndexerTask.doRun(AbstractIndexerTask.java:73) [nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.nexus.scheduling.AbstractNexusTask.call(AbstractNexusTask.java:166) [nexus-app-2.3.1-01.jar:2.3.1-01] jvm 1 | at org.sonatype.scheduling.DefaultScheduledTask.call(DefaultScheduledTask.java:459) [sisu-task-scheduler-1.7.jar:na] {noformat} State reproduced in 2.2.1, 2.3.1-01 and 2.4.0-09.

    Sonatype JIRA | 4 years ago | Peter Lynch
    org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/app/nexus-testing/2.3.1-01/nexus-professional-2.3.1-01-bundle-2/sonatype-work/nexus/indexer/hosted-1-ctx/write.lock
  2. 0

    Initializing and locks

    Google Groups | 4 years ago | Dan Fairs
    org.elasticsearch.index.gateway.IndexShardGatewayRecoveryException: [production_tweets_for_2013_36][1] Failed to fetch index version after copying it over
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    How to solve the 'Lock obtain timed out' when using Solr plainly?

    Stack Overflow | 3 years ago | Emre Sevinç
    org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/solr/solr3/biomina/solr/original/data/index/write.lock
  5. 0

    Crawl keeps locking itself

    GitHub | 4 months ago | robfromca
    com.jaeksoft.searchlib.SearchLibException: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/xxxxxxxx/data/site/index/write.lock

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.apache.lucene.store.LockObtainFailedException

      Lock obtain timed out: NativeFSLock@/app/nexus-testing/2.3.1-01/nexus-professional-2.3.1-01-bundle-2/sonatype-work/nexus/indexer/hosted-1-ctx/write.lock

      at org.apache.lucene.store.Lock.obtain()
    2. Lucene
      IndexWriter.<init>
      1. org.apache.lucene.store.Lock.obtain(Lock.java:84)[lucene-core-3.6.1.jar:3.6.1 1362471 - thetaphi - 2012-07-17 12:40:12]
      2. org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1098)[lucene-core-3.6.1.jar:3.6.1 1362471 - thetaphi - 2012-07-17 12:40:12]
      2 frames
    3. Maven :: Indexer Core
      DefaultIndexingContext.<init>
      1. org.apache.maven.index.context.NexusIndexWriter.<init>(NexusIndexWriter.java:53)[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3]
      2. org.apache.maven.index.context.DefaultIndexingContext.openAndWarmup(DefaultIndexingContext.java:473)[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3]
      3. org.apache.maven.index.context.DefaultIndexingContext.prepareCleanIndex(DefaultIndexingContext.java:238)[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3]
      4. org.apache.maven.index.context.DefaultIndexingContext.prepareIndex(DefaultIndexingContext.java:216)[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3]
      5. org.apache.maven.index.context.DefaultIndexingContext.<init>(DefaultIndexingContext.java:147)[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3]
      6. org.apache.maven.index.context.DefaultIndexingContext.<init>(DefaultIndexingContext.java:167)[indexer-core-5.1.1-d928049c927da992071a6c6bba892568dbcf27a3.jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3]
      6 frames
    4. Sonatype Nexus Indexer
      DefaultIndexerManager.addRepositoryIndexContext
      1. org.sonatype.nexus.index.NexusIndexingContext.<init>(NexusIndexingContext.java:45)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      2. org.sonatype.nexus.index.DefaultIndexerManager.addRepositoryIndexContext(DefaultIndexerManager.java:465)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      3. org.sonatype.nexus.index.DefaultIndexerManager.access$000(DefaultIndexerManager.java:186)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      4. org.sonatype.nexus.index.DefaultIndexerManager$1.run(DefaultIndexerManager.java:430)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      5. org.sonatype.nexus.index.DefaultIndexerManager.exclusiveSingle(DefaultIndexerManager.java:2538)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      6. org.sonatype.nexus.index.DefaultIndexerManager.addRepositoryIndexContext(DefaultIndexerManager.java:424)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      7. org.sonatype.nexus.index.DefaultIndexerManager.addRepositoryIndexContext(DefaultIndexerManager.java:402)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      7 frames
    5. ${project.groupId}:${project.artifactId}
      DefaultEventInspectorHost.onEvent
      1. org.sonatype.nexus.events.IndexingRepositoryRegistryRepositoryEventInspector.inspectForIndexerManager(IndexingRepositoryRegistryRepositoryEventInspector.java:96)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      2. org.sonatype.nexus.events.IndexingRepositoryRegistryRepositoryEventInspector.inspect(IndexingRepositoryRegistryRepositoryEventInspector.java:81)[nexus-indexer-lucene-plugin-2.3.1-01.jar:2.3.1-01]
      3. org.sonatype.nexus.events.DefaultEventInspectorHost.processEvent(DefaultEventInspectorHost.java:131)[nexus-app-2.3.1-01.jar:2.3.1-01]
      4. org.sonatype.nexus.events.DefaultEventInspectorHost.onEvent(DefaultEventInspectorHost.java:104)[nexus-app-2.3.1-01.jar:2.3.1-01]
      4 frames