Solution skill
Locks aren't being released when an error is thrown inside a transaction!
Complete solution
Fixes @planetscale/database holding locks for 20 seconds after a transaction error. The package was not rolling back correctly on error. Upgrade to v1.10.0 or later; the release fixed it and the reporter confirmed their previously failing tests passed. Use when locks linger after transaction errors. Not for other lock issues.
Fix first: upgrade to v1.10.0 or later. The package was not rolling back correctly on error.
- Upgrade @planetscale/database to v1.10.0+.
- Re-run the failing tests. Expected: locks release on error; the reporter confirmed their previously failing tests passed.
When to use: @planetscale/database holds locks for 20 seconds after a transaction error.
When not to use: other lock issues (different causes).
Compatibility: @planetscale/database v1.10.0+. Reported in planetscale/database-js#124.
Variants:
- "planetscale locks not released"
- "planetscale transaction rollback"
- "database-js 124"
Root cause: the package wasnt rolling back correctly on error.
Edge cases: none; the fix is version-bound.
Evidence
In gh:planetscale/database-js#124 (https://github.com/planetscale/database-js/issues/124), the issue reported: Originally, I thought this was an issue with kysely-planetscale I raised an issue on their github and we have narrowed it down to an issue with the core @planetscale/database package. Essentially, when you have a simple transaction and an error is raised and you try do another operation such as delete on the table you will get a 20 second timeout because the locks aren't being released. The verified answer: If @planetscale/database holds locks for 20 seconds after a transaction error, upgrade to v1.10.0 or later. The package was not rolling back correctly on error; the release fixed it and the reporter confirmed their previously failing tests passed.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_0MH2_aVhx8QjJiy0zxNlNw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Locks aren't being released when an error is thrown inside a transaction! <span>— Vectle</span></a>