Add assertion logs for uncaught exceptions in root CompletionHandlers

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Logging
    • None
    • None
    • Java Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      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.

              Assignee:
              Unassigned
              Reporter:
              Slav Babanin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: