imbajin commented on code in PR #3138:
URL: https://github.com/apache/hugegraph/pull/3138#discussion_r3709100263


##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -1353,7 +1353,7 @@ public HugeGraph createGraph(String graphSpace, String 
name, String creator,
         }
 
         // Let gremlin server and rest server context add graph
-        this.eventHub.notify(Events.GRAPH_CREATE, graph);
+        this.notifyAndWaitEvent(Events.GRAPH_CREATE, graph);

Review Comment:
   ⚠️ Making this path synchronous also introduces an unbounded request wait: 
notifyAndWaitEvent() calls future.get() without a timeout at 
GraphManager.java:1777, and its catch(Throwable) swallows InterruptedException 
without restoring the interrupt status. A hung listener or shutdown can now 
hold the create request indefinitely, or return before registration after 
interruption. Please use a bounded wait and handle InterruptedException 
explicitly.



##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/core/GraphManager.java:
##########
@@ -1353,7 +1353,7 @@ public HugeGraph createGraph(String graphSpace, String 
name, String creator,
         }
 
         // Let gremlin server and rest server context add graph
-        this.eventHub.notify(Events.GRAPH_CREATE, graph);
+        this.notifyAndWaitEvent(Events.GRAPH_CREATE, graph);

Review Comment:
   ⚠️ This wait only guarantees that the listener task completed, not that 
graph registration succeeded. EventHub.notify() catches every listener 
Throwable at 
hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/event/EventHub.java:200-205,
 while notifyAndWaitEvent() catches future.get() failures at 
GraphManager.java:1777-1780. A failing ContextGremlinServer.injectGraph() can 
therefore leave the new graph absent from the Gremlin graph/traversal/global 
bindings while this PD create still returns success. Please propagate 
GRAPH_CREATE registration failures or verify the required bindings before 
responding.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to