dosubot[bot] commented on issue #2939: URL: https://github.com/apache/incubator-hugegraph/issues/2939#issuecomment-3758748705
<!-- Greeting --> Hi @QiuYucheng2003! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the incubator-hugegraph team. <!-- Answer --> Your analysis is correct: in Consumers.java, using executor.submit() without ever calling Future.get() can cause exceptions thrown outside the main runAndDone() logic (such as in ContextCallable initialization or JVM errors) to be silently swallowed, resulting in undetected thread failures. The code currently logs and stores exceptions only if they occur inside runAndDone(), but any exception outside that scope is captured by the Future and never surfaced, since await() does not check the Futures at all. This means the system may believe all consumer threads are healthy when some have actually failed silently [cite 1](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java). Your recommendation is spot on: switching to executor.execute() (if you don't need the Future) lets the JVM's UncaughtExceptionHandler catch and log unhandled exceptions, making failures visible. Alternatively, explicitly calling Future.get() (as shown in ExceptionUtil.futureGet and BaseUnitTest.runWithThreads) ensures exceptions are not missed [cite 2](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java) [cite 3](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/unit/BaseUnitTest.java). No similar issues or fixes for this bug have been discussed or merged in the HugeGraph repository so far. Your report highlights a real risk and a clear improvement for thread reliability and observability. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/a83086ef-0cae-4633-9bca-d395558191f0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/a83086ef-0cae-4633-9bca-d395558191f0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/a83086ef-0cae-4633-9bca-d395558191f0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/a83086ef-0cae-4633-9bca-d395558191f0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a83086ef-0cae-4633-9bca-d395558191f0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/a83086ef-0cae-4633-9bca-d395558191f0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/a83086ef-0cae-4633-9bca-d395558191f0?feedback_type=other)</sup> [](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=github) [](https://cursor.com/link/prompt?text=Your%20analysis%20is%20correct%3A%20in%20Consumers.java%2C%20using%20executor.submit%28%29%20without%20ever%20calling%20Future.get%28%29%20can%20cause%20exceptions%20thrown%20outside%20the%20main%20runAndDone%28%29%20logic%20%28such%20as%20in%20ContextCallable%20initialization%20or%20JVM%20errors%29%20to%20be%20silently%20swallowed%2C%20resulting%20in%20undetected%20thread%20failures.%20The%20code%20currently%20logs%20and%20stores%20exceptions%20only%20if%20they%20occur%20inside%20runAndDone%28%29%2C%20but%20any%20exception%20outside%20that%20scope%20is%20captured%20by%20the%20Future%20and%20never%20surfaced%2C%20since%20await%28%29%20does%20not%20check%20the%20Futures%20at%20all.%20This%20means%20the%20system%20may%20believe%20all%20consumer%20thr eads%20are%20healthy%20when%20some%20have%20actually%20failed%20silently%C2%A0%5Bcite%201%5D%28https%3A//github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/util/Consumers.java%29.%0A%0AYour%20recommendation%20is%20spot%20on%3A%20switching%20to%20executor.execute%28%29%20%28if%20you%20don%27t%20need%20the%20Future%29%20lets%20the%20JVM%27s%20UncaughtExceptionHandler%20catch%20and%20log%20unhandled%20exceptions%2C%20making%20failures%20visible.%20Alternatively%2C%20explicitly%20calling%20Future.get%28%29%20%28as%20shown%20in%20ExceptionUtil.futureGet%20and%20BaseUnitTest.runWithThreads%29%20ensures%20exceptions%20are%20not%20missed%C2%A0%5Bcite%202%5D%28https%3A//github.com/apache/incubator-hugegraph/blob/master/hugegraph-commons/hugegraph-common/src/main/java/org/apache/hugegraph/util/ExceptionUtil.java%29%C2%A0%5Bcite%203%5D%28https%3A//github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-test/ src/main/java/org/apache/hugegraph/unit/BaseUnitTest.java%29.%0A%0ANo%20similar%20issues%20or%20fixes%20for%20this%20bug%20have%20been%20discussed%20or%20merged%20in%20the%20HugeGraph%20repository%20so%20far.%20Your%20report%20highlights%20a%20real%20risk%20and%20a%20clear%20improvement%20for%20thread%20reliability%20and%20observability.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2939) -- 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]
