Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5923

Unhandled errors not caught on transaction transition errors

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.3.0
    • Component/s: Transactions
    • 2

      Use Case

      As a developer utilizing the MongoDB Node.js driver for transactional operations,
      I want to be able to catch MongoRuntimeErrors, caused by invalid state transitions.
      So that my application can manage transactional flows more predictably and recover from errors gracefully.

      The error thrown here: https://github.com/mongodb/node-mongodb-native/blob/main/src/transactions.ts#L168 is not handled via the callback in the following lines:

      https://github.com/mongodb/node-mongodb-native/blob/main/src/sessions.ts#L663
      https://github.com/mongodb/node-mongodb-native/blob/main/src/sessions.ts#L677
      https://github.com/mongodb/node-mongodb-native/blob/main/src/sessions.ts#L723
      https://github.com/mongodb/node-mongodb-native/blob/main/src/sessions.ts#L732
      https://github.com/mongodb/node-mongodb-native/blob/main/src/sessions.ts#L990
      https://github.com/mongodb/node-mongodb-native/blob/main/src/sessions.ts#L1016

      User Impact

      This issue potentially impacts all users of the driver who rely on transactions, especially in production environments where unhandled exceptions can lead to application instability or downtime.
      The severity of the impact is high, as unhandled exceptions can crash the application or lead to inconsistent transaction states.

      Dependencies

      Unknowns

      The exact conditions under which the MongoRuntimeError is thrown within the transaction state machine are unclear and need to be investigated.
      Whether there are other unhandled exceptions in the transaction handler or other parts of the driver that could cause similar issues.

      Acceptance Criteria

      All errors during a transactions should bubble up to the caller so the application can handle them accordingly.

      Implementation Requirements

      Documentation Requirements

      Follow Up Requirements

        1. screenshot-2.png
          screenshot-2.png
          54 kB
        2. screenshot-1.png
          screenshot-1.png
          23 kB

            Assignee:
            warren.james@mongodb.com Warren James
            Reporter:
            karacsonym@mediamarktsaturn.com Maximilian Grossmann
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: