Executing query returns context.Canceled in most cases when context canceled.
However, we see use of closed network connection rarely when context canceled during querying or executing.
For error handling purposes, it is preferable to always return context.Canceled.
Issue description
Executing query returns context.Canceled in most cases when context canceled. However, we see
use of closed network connection
rarely when context canceled during querying or executing.For error handling purposes, it is preferable to always return context.Canceled.
similar issue: https://github.com/go-sql-driver/mysql/issues/1078
Example code
It seems that use of closed network connection occurs when ctx is canceled at a specific timing while the connection is being established.
Error log
Configuration
Driver version (or git SHA): v1.7.1 f20b2863636093e5fbf1481b59bdaff3b0fbb779 Go version: go version go1.22.4 darwin/arm64 Server version: Mysql 8.0
Server OS: Debian GNU/Linux 11 (bullseye)