mysql_async icon indicating copy to clipboard operation
mysql_async copied to clipboard

Operation timed out (os error 60) - how to reduce/configure the timeout ?

Open nbari opened this issue 5 years ago • 3 comments

How to configure the timeout for the client when making a connection?, for testing I changed port 3306 to a random "closed" port but approximately after a minute the client returns:

Could not connect to MySQL: Input/output error: Input/output error: Operation timed out (os error 60)

I though that conn_ttl could help to reduce the time for trying the connection therefore, I used:

 let opts = mysql_async::OptsBuilder::default()
 .conn_ttl(Duration::new(5, 0));

But still, the client tries to connect for a while.

Is there a way to configure the connection timeout?

I also tried with:

let pool_opts = PoolOpts::default() // before pool_options
.with_inactive_connection_ttl(Duration::from_secs(5));

But still keeps trying for 60 secs

nbari avatar Oct 24 '20 14:10 nbari

Hi. There is no tcp_connect_timeout option in mysql_async. Adding this shouldn't be hard (it's already implemented in the synchronous driver), so I'll add it in the next version. I suggest you to use something like tokio's Timeout until then.

blackbeam avatar Oct 24 '20 18:10 blackbeam