Copilot commented on code in PR #2941:
URL:
https://github.com/apache/incubator-hugegraph/pull/2941#discussion_r2715647020
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java:
##########
@@ -104,9 +104,23 @@ public void start(String name) {
LOG.info("Starting {} workers[{}] with queue size {}...",
this.workers, name, this.queueSize);
for (int i = 0; i < this.workers; i++) {
- this.runningFutures.add(
- this.executor.submit(new
ContextCallable<>(this::runAndDone)));
+ this.runningFutures.add(this.executor.submit(this::safeRun));
}
+
+ }
+ private Void safeRun() {
+ try {
+ new ContextCallable<>(this::runAndDone).call();
+ } catch (Throwable e) {
+ LOG.error("Worker failed before runAndDone()", e);
Review Comment:
The error message "Worker failed before runAndDone()" is potentially
misleading. This catch block can catch exceptions from multiple scenarios: 1)
ContextCallable failing before entering runAndDone() (e.g., during
setContext()), 2) ContextCallable failing after runAndDone() returns (e.g.,
during resetContext() in the finally block). Consider using a more accurate
message like "Worker failed in ContextCallable wrapper" or conditionally
logging based on whether runAndDone() was entered.
```suggestion
LOG.error("Worker failed in ContextCallable wrapper", e);
```
--
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]