Skip to content

[Bug] Potential silent thread failure in Consumers.java due to unchecked Future #2939

@QiuYucheng2003

Description

@QiuYucheng2003

Bug Type (问题类型)

logic (逻辑设计问题)

Before submit

  • 我已经确认现有的 IssuesFAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

Server Version: N/A (Found in Source Code Analysis / Master Branch)

Backend: N/A

OS: N/A

Data Size: N/A

Expected & Actual behavior (期望与实际表现)

Expected Behavior:
When Consumers threads encounter a critical error (e.g., inside ContextCallable initialization or an Error that escapes the internal try-catch), the exception should be logged or propagated to the UncaughtExceptionHandler to alert the system.

Actual Behavior:
In Consumers.java, tasks are submitted using executor.submit(...) (Line 110), but the returned Future is never checked (no future.get() is called in await() or elsewhere). This causes a "swallowed exception" scenario:

  1. Exceptions occurring outside the runAndDone() internal try-catch block (e.g., in ContextCallable wrapper or strictly internal JVM errors) are captured by the Future.

  2. Since the Future is ignored, these exceptions remain invisible. The system believes the consumer is running, but the thread may have terminated silently.

Code / Logs:
// Consumers.java
public void start(String name) {
// ...
for (int i = 0; i < this.workers; i++) {
// Problem: 'submit' is used but the returned Future is never checked via .get()
// If an exception happens outside runAndDone's try-catch, it is swallowed.
this.runningFutures.add(
this.executor.submit(new ContextCallable<>(this::runAndDone)));
}
}

Recommendation:
Change submit() to execute() if the return value is not needed, which allows the JVM's UncaughtExceptionHandler to catch unhandled exceptions. Or ensure future.get() is checked during the lifecycle management.

Vertex/Edge example (问题点 / 边数据举例)

N/A

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions