MySqlConnector: Implement CommandTimeout
1. Implement DefaultCommandTimeout
in the connection string
Connection String Documentation
2. Implement CommandTimeout
in MySqlCommand
MySqlCommand cmd = new MySqlCommand();
cmd.CommandTimeout = 60;
Implementation Notes:
MySQL Connector/Net 6.2 introduced timeouts that are aligned with how Microsoft handles SqlCommand.CommandTimeout. This property is the cumulative timeout for all network reads and writes during command execution or processing of the results. A timeout can still occur in the MySqlReader.Read method after the first row is returned, and does not include user processing time, only IO operations. The 6.2 implementation uses the underlying stream timeout facility, so is more efficient in that it does not require the additional timer thread as was the case with the previous implementation.
It sounds like Oracle’s implementation of CommandTimeout
is setting Socket.SendTimeout and Socket.ReceiveTimeout. They start at the timeout value (e.g. 30 seconds) and subtract only time spent in I/O. This becomes the send or receive timeout for the next socket command.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 35 (19 by maintainers)
Commits related to this issue
- Implement CommandTimeout. Fixes #67 DefaultCommandTimeout is set to 0 (i.e., no timeout) instead of 30 as in MySql.Data. This should remove unnecessary performance overhead of setting a timer for eve... — committed to bgrainger/MySqlConnector by bgrainger 7 years ago
- Implement CommandTimeout. Fixes #67 DefaultCommandTimeout is set to 0 (i.e., no timeout) instead of 30 as in MySql.Data. This should remove unnecessary performance overhead of setting a timer for eve... — committed to bgrainger/MySqlConnector by bgrainger 7 years ago
- Implement CommandTimeout. Fixes #67 DefaultCommandTimeout is set to 0 (i.e., no timeout) instead of 30 as in MySql.Data. This should remove unnecessary performance overhead of setting a timer for eve... — committed to bgrainger/MySqlConnector by bgrainger 7 years ago
- Implement CommandTimeout. Fixes #67 DefaultCommandTimeout is set to 0 (i.e., no timeout) instead of 30 as in MySql.Data. This should remove unnecessary performance overhead of setting a timer for eve... — committed to bgrainger/MySqlConnector by bgrainger 7 years ago
- Implement CommandTimeout. Fixes #67 DefaultCommandTimeout is set to 0 (i.e., no timeout) instead of 30 as in MySql.Data. This should remove unnecessary performance overhead of setting a timer for eve... — committed to bgrainger/MySqlConnector by bgrainger 7 years ago
- Implement CommandTimeout. Fixes #67 DefaultCommandTimeout is set to 0 (i.e., no timeout) instead of 30 as in MySql.Data. This should remove unnecessary performance overhead of setting a timer for eve... — committed to bgrainger/MySqlConnector by bgrainger 7 years ago
- Implement (Default)CommandTimeout. Fixes #67 — committed to bgrainger/MySqlConnector by bgrainger 7 years ago
Implemented in 0.29.0.
The server_id global variable is used in replicated setups. It is required to be unique for replication to start, but looks like it’s not sent in the initial handshake packet.
There is a “Replication” option that can be set in the connection string. If this was set, we could run a
SELECT @@server_id
query as part of the connection open process.The worry is that without comparing
server_id
before killing a query from a separate connection on a replicated setup, we could actually be killing a valid query on a different server that has the sameconnection_id
.