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

Guoqiang Jiang commented on LUCENE-7919:
----------------------------------------

why not just remove it?

> excessive use of notifyAll
> --------------------------
>
>                 Key: LUCENE-7919
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7919
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 6.6
>            Reporter: Guoqiang Jiang
>
> 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:
> {code:java}
> "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)
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to