Alexey Serbin has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/21041 )

Change subject: [Java] Fix concurrent problem while traversing the traces of 
KuduRpc.
......................................................................

[Java] Fix concurrent problem while traversing the traces of KuduRpc.

When the RPC request which is sent by java client times out, the
RpcTimeoutTask is called by HashedWheelTimer. During the running
of this task, KuduRpc#toString() is called. This method will traverse
the traces(a synchronizedList) without any protection, which leads to
exception in timeout task and then the callback will not be triggered.

The exception message is as follow:

An exception was thrown by TimerTask.
java.util.ConcurrentModificationException: null
        at java.util.ArrayList$Itr.checkForComodification
        at java.util.ArrayList$Itr.next
        at org.apache.kudu.client.RpcTraceFrame
           .getHumanReadableSummaryStringForTraces
        at org.apache.kudu.client.KuduRpc.toString
        at java.lang.String.valueOf
        at java.lang.StringBuilder.append
        at org.apache.kudu.client.KuduRpc$RpcTimeoutTask.run
        at org.apache.kudu.shaded.io.netty.util
           .HashedWheelTimer$HashedWheelTimeout.expire

So make a copy of the traces and then traverse the copy. This method
is mostly called when some exceptions are raised, so the influence on
performance should be acceptable.

Change-Id: I1a642d93d01ebcfa05b01fe263023b5580d2542b
Reviewed-on: http://gerrit.cloudera.org:8080/21041
Reviewed-by: Alexey Serbin <ale...@apache.org>
Tested-by: Alexey Serbin <ale...@apache.org>
---
M java/kudu-client/src/main/java/org/apache/kudu/client/KuduRpc.java
1 file changed, 10 insertions(+), 2 deletions(-)

Approvals:
  Alexey Serbin: Looks good to me, approved; Verified

--
To view, visit http://gerrit.cloudera.org:8080/21041
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1a642d93d01ebcfa05b01fe263023b5580d2542b
Gerrit-Change-Number: 21041
Gerrit-PatchSet: 10
Gerrit-Owner: Song Jiacheng <599042...@qq.com>
Gerrit-Reviewer: Alexey Serbin <ale...@apache.org>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Song Jiacheng <599042...@qq.com>

Reply via email to