Bug #58341 System var net_write_timeout has effect in protocols when it shouldn't
Submitted: 20 Nov 2010 0:45 Modified: 13 Jan 2011 16:41
Reporter: Erica Moss Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.5.7 OS:Windows (windows x64)
Assigned to: Paul DuBois CPU Architecture:Any

[20 Nov 2010 0:45] Erica Moss
Description:
According to the manual:
"The number of seconds to wait for a block to be written to a connection before aborting the write. This timeout applies only to TCP/IP connections, not to connections made using Unix socket files, named pipes, or shared memory"

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_net_write_timeo...

In both Servers 5.1 and 5.5 it is apparent that setting the var to a low value is having effect in windows using a named pipe.  It is not certain whether the behavior has be extended and the manual is simply not up to date.  If that is the case, then this is a documentation issue not a Server bug.  If the functionality was not deliberately changed from 5.0 then it appears it would be a regression.

The same test code can be used to prove that the var is having effect in both Pipes, and Sockets by simply changing the protocol.

How to repeat:
Two ways to repeat:

1. Run the connector Net 5.3 testcase TimeoutAndCancelPipe.Net_Write_TimeoutExpiring

OR 

2. Create the test file described below and save
   Start the server as mysqld --enable-named-pipe --socket=MySQL 
   Run mysqltest --protocol=PIPE -uroot --test-file=<path to test file>

SET net_write_timeout=1;

SHOW VARIABLES LIKE '%pipe%';

--disable_warnings
DROP TABLE IF EXISTS test.t;
--enable_warnings

CREATE TABLE test.t ( i INT ) ;
INSERT INTO test.t values (1),(2),(3),(4),(5);
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;
INSERT INTO test.t SELECT * FROM test.t;

--send SELECT * FROM test.t

--sleep 3

connection default;
--disable_result_log
reap;
--enable_result_log

SELECT COUNT(*) FROM test.t;

DROP TABLE test.t;

# EOF
[20 Nov 2010 11:10] Davi Arnaut
Since at least 5.1, timeouts apply to all transport types. Documentation needs to be updated.
[20 Nov 2010 11:14] Davi Arnaut
Timeout for named pipe and shared memory were introduced in the patch for the following bug reports:

Bug#47571: idle named pipe connection is unkillable
Bug#31621: Windows server hanging during shutdown using named pipes ..

The message in the patch:

"Note, that with this patch timeouts are properly handled for named pipes."

"Post-review: Win32 timeout code has been fixed for named pipes and shared memory. We do not store pointer to NET in vio structure, only the read and write timeouts."

The connection between net_write_timeout and this should have been made more clear.
[13 Jan 2011 16:41] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

As of 5.1.41, net_read_timeout and net_write_timeout apply to all transports, not just TCP/IP.