Page 2 of 2

Re: The "MySQL has gone away" mystery

Posted: Fri Oct 02, 2015 1:43 pm
by John Adams
Alrighty, I think I finally figured this out - while it is not the root cause, it is a good recovery option for our world and login servers. According to this article:

https://dev.mysql.com/doc/refman/5.0/en ... nnect.html
[quote]In MySQL 5.0, auto-reconnect was enabled by default until MySQL 5.0.3, and disabled by default thereafter. The MYSQL_OPT_RECONNECT option is available as of MySQL 5.0.13.[/quote]
Seems regardless what the "variables" values are in MySQL, the C++ code was not auto-reconnecting. I added this to the constructor, right under mysql_init(),

Code: Select all

	my_bool reconnect = 1;
	mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
and had Xinux log into the world. I then disabled the NIC on the MySQL box and started seeing errors. With this code in place, the SQL connection woke back up and continued to save the player data without issue.

So until I solve the network issue at least, this will keep the world from dying. Players still might need to re-log in, as Xinux reported losing chat channels and whatnot, but at least your data is safe.