Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance Issue with withTransaction API Causing Prolonged Execution and 502 Errors #14939

Open
2 tasks done
deepsangani97271 opened this issue Oct 7, 2024 · 0 comments
Open
2 tasks done

Comments

@deepsangani97271
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.7.0

Node.js version

20.11.1

MongoDB server version

8.0.0

Typescript version (if applicable)

5.5.3

Description

When using the withTransaction API with Mongoose to handle transactions, I’m encountering significant delays that ultimately result in 502 errors. However, when I handle transactions manually (starting, committing, and aborting), the same operations complete successfully and within expected timeframes. This suggests an inefficiency or potential bug within withTransaction.

Steps to Reproduce

  1. Start a transaction using session.withTransaction.
  2. Perform multiple database operations within the transaction, including create, update, and delete across various collections.
  3. Observe that the transaction takes considerably longer than expected, sometimes leading to a 502 error in the backend.

Expected Behavior

The withTransaction API should handle transactions efficiently, ensuring all operations are either committed or rolled back in a timely manner without introducing unexpected delays.

Observed Behavior

Prolonged transaction times, resulting in 502 errors.
The issue does not occur with manual transaction handling (startTransaction, commitTransaction, and abortTransaction).
Delays are more noticeable under higher loads or with concurrent transactions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant