sidorares / sidorares/node-mysql2
Binding error prevents rollback and SQL connection hangs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
If an SQL session is in a transaction and a binding error occurs on a prepared statement (e.g., a bind of an undefined value is attempted), the driver will throw an exception.
When the application catches the exception, calling the .query() method with 'ROLLBACK' as a SQL statement simply hangs and never returns. The SQL statement is not passed to the server.
A failing bind should still allow the execution of subsequent queries inside the transaction - there may be a savepoint to revert to, or the client may simply retry with correct values etc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the prepared-statement binding error path and the transaction handling behind .query(). Reproduce an undefined-value bind failure, catch it, then issue ROLLBACK and a subsequent query. Done means the rollback and later query are sent to the server and complete instead of hanging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, nodejs, typescript
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100