Found a true cause and a possible resolution to the "MySQL server has gone away" issue

Hi Everyone,

Based upon what I have seen in the Request Tracker code, and those who
are more familiar with it can correct me if I am wrong, I think I may
have found at least one explanation why one would get the message “MySQL
server has gone away” series of messages when adding a ticket in Request
Tracker. Of course, one should make sure that their CPAN libraries are
all up to date and that they do not have unusually low timeout numbers
in the MySQL my.cnf file, as it is possible older software and an
incorrectly configure MYSQL server could contribute to the problem. I
have done this as part of my research into the problem

Upon my research I determined that when someone starts a Request Tracker
session, the user is assigned a cookie identifier for the duration of
the session. The cookie is given to the web server by Request Tracker
and MySQL is informed that the user will be connecting to to MySQL with
the cookie identifier as the database handle to establish the
connection. So, the web server, Request Tracker and MySQL should all be
in sync with the cookie identifier for the session.

What we discovered, if someone relocates a laptop to another location of
the building and they leave their laptop logged into Request Tracker,
but during the move the network connection drops and reestablishes
itself, the cookie identifier may get expired by the web browser
(Microsoft Explorer in this case). When the user use starts to use
Request Tracker, after the move, they notice nothing out of the ordinary
because they are still logged in. Matter of fact they seem to process
normally (web pages get loaded for the function they are doing) until
they try to submit a ticket or make an update to a ticket. Because the
cookie identifier is expired, Request Tracker does not check to see if
the cookie is really expired and passes the user on to MySQL which
already dropped the session because the cookie was expired. Request
Tracker assumes that if you are logged in, then you have a valid cookie
and a valid session. However, it does not verify the cookie is valid
because of the above assumption. The end result, MySQL detects someone
trying to write to the database on a nonexistent connection; then end
result “MySQL server has gone away” will be generated (no cookie = no
connection to MySQL).

Again, while this is not a complete explanation to the problem and I do
not have detailed expertise in the internals of Request Tracker, I
believe what I described here makes logical sense. Also, an individual
who generated the problem relayed to me exactly what they did and it was
described in the previous paragraph.

I hope you find this information useful.

Take care!

Nick

PS For the developers of Request Tracker, it may be a good idea to force
Request Tracker to always check to see if the cookie is valid, if not,
then the software should force a logout or at least inform the user to
logout and login again. It will also be a good idea for them to clear
the web browser cache, before logging in.

Nick Metrowsky

Consulting System Administrator

303-684-4785 Office

303-684-4100 Fax

nmetrowsky@digitalglobe.com mailto:nmetrowsky@digitalglobe.com

DigitalGlobe (r), An Imaging and Information Company

http://www.digitalglobe.com http://www.digitalglobe.com

and MySQL is informed that the user will be connecting to to MySQL with
the cookie identifier as the database handle to establish the
connection.

That is not correct. RT shares one connection across all users.

Hi Jesse,

Thank you for writing and your correction I appreciate it. While there
is one connection to MySQL as you say via port 3306. I know cookies are
involved from the web browser to Request Tracker to MySQL, because the
cookie session identifiers show up in the MySQL detail transaction logs.
I am not sure if this is an Explorer problem (timeout the cookies) or a
network drop problem (could also timeout a cookie or at least corrupt
the seesion). I have not seen this problem on Firefox, Mozilla or
Netscape. Finally, this problem occurs in 1 in 1000 tickets, which for
us is about once per month.

The Request Tracker code does assume that you have a valid connection to
MySQL and a valid database handle. I have seen this is at least a couple
areas of the code. This seems logical, because if you are logged in to
Request Tracker one can assume you have a connection to the MySQL
database, as well. The things I would recommend here is to verify that a
connection to MySQL is still active, as well as the session, before
attempting to write to the database. Also, only have Request Tracker
send out e-mails after it verifies that a ticket has been written to the
database. We can live with the error, but we need a fix to prevent the
e-mail from going out as it really frustrates our staff that a ticket is
not in the database.

As I mentioned, I just wanted to tell folks about what we have been
seeing at our site. I also wanted to mention that we have seen this
occur on laptops that are moved from one location to another, with
Request Tracker still logged in. The person having the problem told me
that “come to think of it, I always move my laptop while in Request
Tracker and the error has usually occurred sometime after I have done
it”. This provided me with enough compelling evidence to tell our site
to log out of Request Tracker, before moving a laptop. The jury is still
out on this one.

All in all, Request Tracker is a very good product. Our IS departments
and several departments at my company really like the software. The only
complaint is this one issue. Also, we have been using the software for
over four years and plan to continue to use it for the foreseeable
future. Once things get stable, we plan to move from 3.4.4 to 3.6.x.

Thank you again for writing and I hope that something good comes out of
this.

Take care!

Nick

Nick Metrowsky
Consulting System Administrator
303-684-4785 Office
303-684-4100 Fax
nmetrowsky@digitalglobe.com
DigitalGlobe (r), An Imaging and Information Company
http://www.digitalglobe.comFrom: Jesse Vincent [mailto:jesse@bestpractical.com]
Sent: Friday, October 06, 2006 4:30 PM
To: Nick Metrowsky
Cc: RT Users
Subject: Re: [rt-users] Found a true cause and a possible resolution to
the “MySQL server has gone away” issue

and MySQL is informed that the user will be connecting to to MySQL
with
the cookie identifier as the database handle to establish the
connection.

That is not correct. RT shares one connection across all users.