beliefer commented on code in PR #26426:
URL: https://github.com/apache/flink/pull/26426#discussion_r2035629008


##########
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java:
##########
@@ -258,12 +270,28 @@ public void addAll(Configuration other, String prefix) {
         bld.append(prefix);
         final int pl = bld.length();
 
-        synchronized (this.confData) {
-            synchronized (other.confData) {
-                for (Map.Entry<String, Object> entry : 
other.confData.entrySet()) {
-                    bld.setLength(pl);
-                    bld.append(entry.getKey());
-                    this.confData.put(bld.toString(), entry.getValue());
+        Object lock1 = this.confData;
+        Object lock2 = other.confData;
+
+        // Ensure consistent lock sequence
+        if (System.identityHashCode(lock1) < System.identityHashCode(lock2)) {
+            synchronized (lock1) {

Review Comment:
   It is always keep the same order of locking objects, so could avoid dead 
lock.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to