Bug #2532 Implications of mysql_ping() autoreconnect not made clear
Submitted: 27 Jan 2004 4:04 Modified: 3 Oct 2008 16:54
Reporter: Tim Bunce Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version: OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[27 Jan 2004 4:04] Tim Bunce
Description:
Implications of mysql_ping() autoreconnect not made clear.

How to repeat:
read http://www.mysql.com/doc/en/mysql_ping.html 

Suggested fix:
http://www.mysql.com/doc/en/mysql_ping.html needs to say load and clear that if the connection was down and reconnected that:

a: you no longer have any locks you may have acquired

b: your old connection may or may not still be running

c: if it is then *it* holds the locks, not you

d: mysql_ping() won't tell you if this has happened so you need to check if mysql_thread_id() has changed.

e: if it has you may want to mysql_kill() the old connection.

f: it would be nice if mysql provided an alternative ping function that:

1: automatically reconnect only if given a flag
2: automatically killed the old one, if given a flag
3: could return the old error code even if it reconnected okay, or perhaps better to leave it available to fetch via mysql_error() etc.
[28 Jan 2004 10:44] Paul DuBois
f) should be submitted a feature request, not a doc issue.
Closing this report will not include any action on f).
[17 Aug 2004 0:52] Brian Aker
Peter, please add item f as a worklog idea.
[19 Aug 2004 5:13] Paul DuBois
This should not be marked as "won't fix." Auto-reconnect
behavior does need to be documented; it just hasn't
happened yet.
[4 Oct 2004 9:53] MySQL Verification Team
Paul changing the status according your last post:

"This should not be marked as "won't fix." Auto-reconnect
behavior does need to be documented; it just hasn't
happened yet"
[23 Nov 2006 12:25] Tim Bunce
Over two years later and this "S2 (Serious)" documentation problem still isn't fixed.

[The docs ccould also say that you can tell if a new connection was made by checking if the thread_id changed]
[27 Sep 2008 9:46] Konstantin Osipov
Stefan, Paul, is there any reason this is still not documented?
[3 Oct 2008 16:54] 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.

There is a section in the manual that describes the effects of reconnecting:
http://dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html

I've added some of the information in this bug report (about using thread ID to detect reconnect and that the session might still be running on the server side) to that section and added a cross reference to the section from the mysql_ping() section.