You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/01/16 06:59:37 UTC

[GitHub] gianm commented on a change in pull request #6868: Fix deadlock in DruidStatement & DruidConnection

gianm commented on a change in pull request #6868: Fix deadlock in DruidStatement & DruidConnection
URL: https://github.com/apache/incubator-druid/pull/6868#discussion_r248163630
 
 

 ##########
 File path: sql/src/main/java/org/apache/druid/sql/avatica/DruidConnection.java
 ##########
 @@ -63,7 +63,7 @@ public DruidConnection(final String connectionId, final int maxStatements, final
     this.connectionId = Preconditions.checkNotNull(connectionId);
     this.maxStatements = maxStatements;
     this.context = ImmutableMap.copyOf(context);
-    this.statements = new HashMap<>();
+    this.statements = new ConcurrentHashMap<>();
 
 Review comment:
   We still need the createStatement logic to be synchronized to ensure the validity of checks like this one:
   
   ```java
         if (statements.size() >= maxStatements) {
           throw new ISE("Too many open statements, limit is[%,d]", maxStatements);
         }
   ```
   
   Without synchronization, that won't actually verify maxStatements properly.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org