This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 277c1567b8f Fix Concurrent bug between NodeSupplier.close() and its
run()
277c1567b8f is described below
commit 277c1567b8f703c1fbd04cbd5d14ac678c2ec5a6
Author: Jackie Tien <[email protected]>
AuthorDate: Fri Mar 15 14:01:55 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();
+ }
}
}