[ https://issues.apache.org/jira/browse/KAFKA-4820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15889476#comment-15889476 ]
ASF GitHub Bot commented on KAFKA-4820: --------------------------------------- GitHub user lindong28 opened a pull request: https://github.com/apache/kafka/pull/2619 KAFKA-4820; ConsumerNetworkClient.send() should not require global lock You can merge this pull request into a Git repository by running: $ git pull https://github.com/lindong28/kafka KAFKA-4820 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/2619.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2619 ---- commit 6a06f25748e7ff47eae27a5e40e74b2d9ac746e9 Author: Dong Lin <lindon...@gmail.com> Date: 2017-03-01T04:15:11Z KAFKA-4820; ConsumerNetworkClient.send() should not require global lock ---- > ConsumerNetworkClient.send() should not require global lock > ----------------------------------------------------------- > > Key: KAFKA-4820 > URL: https://issues.apache.org/jira/browse/KAFKA-4820 > Project: Kafka > Issue Type: Bug > Reporter: Dong Lin > Assignee: Dong Lin > > Currently `ConsumerNetworkClient.send()` needs to acquire global lock of > `ConumserNetworkClient` in order to enqueue requests. If another thread has > called `ConsumerNetworkClient.poll(..)`, that thread may be holding the lock > while blocked on `nioSelector.select(ms)`. This causes problem because the > user thread which calls `ConsumerNetworkClient.send()` will also block > waiting for that `nioSelector.select(ms)` to finish. > One way to address this problem is to use `synchronized (unsent)` to protect > access to `ConsumeNetworkClient.unsent` instead of protecting it using a > global lock. So that user thread should be able to enqueue requests > immediately while another thread is blocked on `nioSelector.select(ms)`. -- This message was sent by Atlassian JIRA (v6.3.15#6346)