fix(adapter-mssql): acquire mutex in commit/rollback to prevent EREQINPROG error#29141
fix(adapter-mssql): acquire mutex in commit/rollback to prevent EREQINPROG error#29141jacek-prisma merged 2 commits intomainfrom
Conversation
WalkthroughImplements mutex-based serialization in MssqlTransaction to prevent race conditions where commit() or rollback() operations could fail if a query is in progress. Adds a comprehensive test suite validating that commit, rollback, and query operations are properly serialized, including error handling scenarios. Changes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/adapter-mssql/src/mssql.ts (1)
81-90:⚠️ Potential issue | 🔴 CriticalBug: double error wrapping in
performIOoverride.
super.performIO(lines 50–63) already catches errors and callsthis.onError(e), which throws aDriverAdapterError. Thecatchblock here (line 85–86) catches that already-wrappedDriverAdapterErrorand feeds it throughthis.onError(e)a second time, applyingconvertDriverErrorto aDriverAdapterErrorinstead of a rawmssqlerror. Remove thecatchblock—thefinallyalone is sufficient to release the mutex, and the error will propagate correctly.Proposed fix
async performIO(query: SqlQuery): Promise<ArrayModeResult> { const release = await this.#mutex.acquire() try { return await super.performIO(query) - } catch (e) { - this.onError(e) } finally { release() } }
size-limit report 📦
|
Cleanup of #29119
Summary by CodeRabbit
Bug Fixes
Tests