Bug #68196 vio_timeout doesn't work in Solaris, and this will cause vio_read block.
Submitted: 28 Jan 2013 2:36 Modified: 21 Jul 2014 20:04
Reporter: Nan Xiao Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:5.5.29 OS:Solaris
Assigned to: CPU Architecture:Any
Tags: block, vio_read, vio_timeout

[28 Jan 2013 2:36] Nan Xiao
Description:
Hi, all;

	Now, the code of vio_timeout:
	{
	#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
		......
		r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO,
                IF_WIN((const char*), (const void*))&wait_timeout,
                sizeof(wait_timeout));
                ......
	#else
	#endif
	}
	
	Because Solaris OS doesn't support SO_SNDTIMEO and SO_RCVTIMEO socket options, the vio_timeout can't take effect. And this may cause vio_read block for a long time or ever.
	So does it need extra processing during vio_timeout for Solaris OS? Thanks very much!

Best Regards
Nan Xiao

How to repeat:
This bug occurs in Solaris OS.
[29 Jan 2013 15:30] MySQL Verification Team
When network does not support timeout, client - server protocol uses thread timeouts, which work beautifully, for example, on Solaris.

In short, this has been taken care of.
[30 Jan 2013 1:06] Nan Xiao
Hi, Sinisa:

    Thanks very much for your reply!
    How can I use thread timeouts? Does it need special compile options when building client and Connector/ODBC? Thanks in advance!

Best Regards
Nan Xiao
[28 Feb 2013 10:14] Bogdan Degtyariov
Hi Nan,

after analyzing the sources we concluded that send and receive timeouts are not supported neither in the socket nor in the protocol in Solarys.

setting mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, readtimeout) comes down to calling setsockopt() and as it was said before such calls have no effect.

However, there is not workaround, which is to use a library that implements the missing functionality.
More details about this library can be found here:

https://www.varnish-cache.org/lists/pipermail/varnish-dev/2011-March/006741.html
[7 May 2013 1:22] Nan Xiao
Hi, Michael Widenius:

    Thanks very much for your reply, and I will try it.

Best Regards
Nan Xiao
[21 Jul 2014 20:04] Sveta Smirnova
I believe this should be "Verified" since everyone agrees that the bug exists.