Closed methane closed 3 months ago
The recent updates enhance error handling in the mysqlConn
struct by incorporating cleanup and logging mechanisms. Specifically, the interpolateParams
and writePacket
methods now invoke mc.cleanup()
and, in the case of writePacket
, also mc.log(err)
upon encountering errors. This ensures better resource management and error reporting.
File | Change Summary |
---|---|
connection.go |
Updated interpolateParams to call mc.cleanup() and return driver.ErrBadConn on buffer error. |
packets.go |
Modified writePacket to call mc.cleanup() and mc.log(err) on write deadline error. |
In code where packets flow and errors might, A rabbit hops to set things right. With cleanup swift and logs so clear, Stability and grace appear. 🐇💻✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Description
interpolateParams() returned ErrInvalidConn without closing the connection. Since database/sql doesn't understand ErrInvalidConn, there is a risk that database/sql reuse this connection and ErrInvalidConn is returned repeatedly.
This PR should be backported to 1.8.
Checklist
Summary by CodeRabbit