Bug #39739 The mysql client automatically adjusts timeout values for negative/ large values
Submitted: 29 Sep 2008 23:21
Reporter: Patrick Crews Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:Any OS:Any
Assigned to: CPU Architecture:Any
Tags: clients, MySQL, timeouts

[29 Sep 2008 23:21] Patrick Crews
Description:
When using the --connect-timeout option with the mysql client, I found that negative or larger inputs are automatically set to  43200

When --connect-timeout is VERY large, an error is thrown (too large for integer error)

While someone *shouldn't* be using a negative value, we should still deal with these kinds of behavior in proper fashion

How to repeat:
I will be attaching a .test file, a .result file and a modified mysql.cc file to speed testing.

The .test file was some work being done on mysql_protocols.test and has a negative value for one line.

The mysql.cc file merely has an extra printf to output the connect_timeout value (if it is non-zero)

Once these are installed, run the following command from the mysql-test directory:

./mtr --force mysql_protocols

Suggested fix:
At the very least, the user should be warned that such a change in values is taking place.
We could go further to decline negative values, but I think notifying the user is sufficient and we could take care of large and negative values in one shot.
[29 Sep 2008 23:22] Patrick Crews
test file for verification

Attachment: mysql_protocols.test (, text), 849 bytes.

[29 Sep 2008 23:22] Patrick Crews
.result file for verification

Attachment: mysql_protocols.result (, text), 33 bytes.

[29 Sep 2008 23:23] Patrick Crews
modified mysql client (displays --connect_timeout values)

Attachment: mysql.cc (, text), 132.99 KiB.