16

I changed these timeouts globally with:

SET GLOBAL wait_timeout=30; SET GLOBAL interactive_timeout=30

and noticed that I have another application running which got problems with these "low" timeouts. So I would like to undo this and only apply it to the specific database.

3 Answers 3

15

I have the same problem in 5.5.43. I was having the "has gone away" error message for some long queries beyond about 2 minutes. So I tried these 3:

(1) SHOW VARIABLES LIKE 'wait_%';

(2) SHOW global VARIABLES LIKE 'wait_%'; and

(3) SHOW session VARIABLES LIKE 'wait_%'; .

All showed wait_timeout to be 28800. Then I added wait_timeout = 31536000 to /etc/my.cnf. Then my long query was able to complete. And from the 3 ways of showing variables above, only (2) the one with "global" showed a change from 28800 to 31536000. The other 2 were unaffected. Since my long-query was definitely less than 10 minutes long, does this mean that the unit of time used here was milliseconds rather than seconds?

Sign up to request clarification or add additional context in comments.

2 Comments

Is there an official answer on this? If this is indeed miliseconds and not seconds, it's a very serious documentation error...
It is in seconds. It doesn't show up on the above (1) and (3) queries because you need to start a new session as you are looking at the session variables that were set when you started the session (which was before you changed the wait_timeout value)
11

Referring to the MySQL Manual the default values for -

wait_timeout and for interactive_timeout are - 28800 seconds

REMEMBER - seconds (28800 in seconds)

Comments

6

Referring to the MySQL Manual the default values for wait_timeout and for interactive_timeout are - 28800.

On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client (as defined by the CLIENT_INTERACTIVE connect option to mysql_real_connect()). See also interactive_timeout.

13 Comments

thanks, so these are in milliseconds and with "SET GLOBAL wait_timeout=30;" its in seconds ?
As on the manual it's said that this time is in seconds! (which is weird for me). 28800 - 8 hours?. It should be in milliseconds and the reason you're having the problem is that 30 milliseconds is to little. It's also said that its scope is session wide. Thus, restarting mysqld should solve the problem.
if the default value of 28800 is in seconds this would be 8 hours. If it is in milliseconds it would be 28,8 seconds so I would have increased it. That sounds odd, like you said. But since I change these two values a program is shouting "FATA: DataSourcePool is donw!!!!" -> The last packet successfully received from the server was 30,003 milliseconds ago." which fits my changed settings
As sure I am as I believe the manual! I think, there is no real reason to change that default value. Besides, it appears that (see comment): There's a difference between queries and connections. You need to at least ensure your web site software won't break if a shorter wait_timeout cause a connection to close when the software expects it to remain open.
Well I got it back on default. Thanks for you help :) I might have to talk to the devs of the software, why the hell they don´t close the connections on restart.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.