Exceptions thrown inside CompletionHandler implementations inÂ
AsynchronousChannelStream can escape up to the executor’s Future returned by submit() in AsynchronousTlsChannelGroup.java#L227-L229 , where they are silently ignored.
This means if an unexpected exception happens, for example after the user callback was already called, or due to some internal driver bugs, it neither propagates to the callback nor triggers Thread's UncaughtExceptionHandler, nor logs anything.
Adding defensive try/catch with explicit assertion logging ensures these errors appear in logs, avoiding silent failures that make debugging and identification of such issues hard. It improves observability and simplifies troubleshooting for users and us.
This is similar to ErrorHandlingCallback.
Acceptance criteria:
- Root completion handlers (WriteCompletionHandler, BasicCompletionHandler, etc.) wrap their logic in try/catch blocks.
- Any uncaught exception is logged once at ERROR level as an assertion failure.
This combined with JAVA-6109, JAVA-6110 ensures that the default uncaught exception handler configured by an application will have a chance to handle all Errors that originate from our code. And if there no uncaught exception handler is configured, the Errors at least will be handled the same way the Java SE handles all uncaught exceptions by default.
- is derived by
-
JAVA-5750 Investigate flaky Multi-batch_bulkWrites test
-
- Closed
-
- related to
-
JAVA-5906 Fix ignored timeout exceptions in AsynchronousChannelStream
-
- Closed
-
-
JAVA-6071 Test failures due to connection leaks and unexpected exceptions in bulk write tests
-
- Investigating
-
- split to
-
JAVA-6109 Properly handle exceptions in scheduled tasks
-
- Needs Triage
-
-
JAVA-6110 Do not wrap Errors
-
- Needs Triage
-
-
JAVA-6106 When we run tests/benchmarks, we should register the default uncaught exception handler to handle uncaught exceptions
-
- Backlog
-
- links to