-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Software versions
MySqlConnector version: 2.3.7
Server type and version: AWS RDS Aurora 8.0.mysql_aurora.3.08.2 + RDS Proxy
.NET version: v8
Describe the bug
When using a query timeout via a CancellationToken
queries are correctly timed out when connecting directly to a local MySQL instance, or directly to an RDS Aurora instance, but when connecting via RDS Proxy the query fails to timeout.
Logging shows that RDS Proxy is returning some sort of internal ID for ServerThread
so when this gets used in the KILL QUERY x
command to cancel the timed out query an error is just returned with 'Unknown thread id: Y' and the query continues.
I've just seen ShouldGetRealServerDetails()
and GetRealServerDetailsAsync()
in ServerSession.cs
which appear to cover this problem, and with a quick bodge to force ShouldGetRealServerDetails()
to return true
cancellation starts working. The 'correct' thread id is available through SELECT CONNECTION_ID();
Would updating ShouldGetRealServerDetails()
to detect RDS Proxy hostnames be an acceptable fix?
They're of the format <custom-proxy-name>.proxy-<random character string>.<aws-region>.rds.amazonaws.com
Alternatively a connection string parameter requesting this behaviour on connection could work?
Expected behavior
MySQL Connector should be able to cancel a running query whilst connected to RDS Proxy
Additional context
Could be considered an RDS Proxy issue rather than a MySqlConnector problem