Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7919

excessive use of notifyAll

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.6
    • Fix Version/s: 7.0
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      I am using Elasticsearch and have a write heavy scene. When tuning with jstack, I found a significant proportion of thread stacks similar to the followings:

      "elasticsearch[test][bulk][T#23]" #126 daemon prio=5 os_prio=0 tid=0x00007f68f8040000 nid=0x6b1 runnable [0x00007f6918ce9000]
         java.lang.Thread.State: RUNNABLE
              at java.lang.Object.notifyAll(Native Method)
              at org.apache.lucene.index.DocumentsWriterPerThreadPool.release(DocumentsWriterPerThreadPool.java:213)
              - locked <0x00000000ea02b6d0> (a org.apache.lucene.index.DocumentsWriterPerThreadPool)
              at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:496)
              at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1571)
              at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1316)
              at org.elasticsearch.index.engine.InternalEngine.index(InternalEngine.java:663)
              at org.elasticsearch.index.engine.InternalEngine.indexIntoLucene(InternalEngine.java:607)
              at org.elasticsearch.index.engine.InternalEngine.index(InternalEngine.java:505)
              at org.elasticsearch.index.shard.IndexShard.index(IndexShard.java:556)
              at org.elasticsearch.index.shard.IndexShard.index(IndexShard.java:545)
              at org.elasticsearch.action.bulk.TransportShardBulkAction.executeIndexRequestOnPrimary(TransportShardBulkAction.java:484)
              at org.elasticsearch.action.bulk.TransportShardBulkAction.executeBulkItemRequest(TransportShardBulkAction.java:143)
              at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:113)
              at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:69)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryShardReference.perform(TransportReplicationAction.java:939)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryShardReference.perform(TransportReplicationAction.java:908)
              at org.elasticsearch.action.support.replication.ReplicationOperation.execute(ReplicationOperation.java:113)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.onResponse(TransportReplicationAction.java:322)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.onResponse(TransportReplicationAction.java:264)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$1.onResponse(TransportReplicationAction.java:888)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$1.onResponse(TransportReplicationAction.java:885)
              at org.elasticsearch.index.shard.IndexShardOperationsLock.acquire(IndexShardOperationsLock.java:147)
              at org.elasticsearch.index.shard.IndexShard.acquirePrimaryOperationLock(IndexShard.java:1657)
              at org.elasticsearch.action.support.replication.TransportReplicationAction.acquirePrimaryShardReference(TransportReplicationAction.java:897)
              at org.elasticsearch.action.support.replication.TransportReplicationAction.access$400(TransportReplicationAction.java:93)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.doRun(TransportReplicationAction.java:281)
              at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:260)
              at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:252)
              at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
              at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:644)
              at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)
              at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      

      After reading the code related with DocumentsWriterPerThreadPool, I think the notifyAll is useless. This is a relatively expensive operation, and should be avoided if possible.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              18519283579 Guoqiang Jiang
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: