You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2024/03/15 02:56:26 UTC
(iotdb) branch ty/nodesupplierbug created (now 62e4d1534c4)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a change to branch ty/nodesupplierbug
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at 62e4d1534c4 Fix Concurrent bug between NodeSupplier.close() and its run()
This branch includes the following new commits:
new 62e4d1534c4 Fix Concurrent bug between NodeSupplier.close() and its run()
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(iotdb) 01/01: Fix Concurrent bug between NodeSupplier.close() and its run()
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch ty/nodesupplierbug
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 62e4d1534c4e20d144db39bc6e0114e5c68dcf97
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Fri Mar 15 10:53:50 2024 +0800
Fix Concurrent bug between NodeSupplier.close() and its run()
---
.../src/main/java/org/apache/iotdb/session/NodesSupplier.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/NodesSupplier.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/NodesSupplier.java
index ccb83b9a12d..8f0244bbcab 100644
--- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/NodesSupplier.java
+++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/NodesSupplier.java
@@ -170,8 +170,11 @@ public class NodesSupplier implements INodeSupplier, Runnable {
}
}
- if (client != null && !updateDataNodeList()) {
- destroyCurrentClient();
+ // make sure the following code block can run thread-safely with close() method.
+ synchronized (this) {
+ if (client != null && !updateDataNodeList()) {
+ destroyCurrentClient();
+ }
}
}