Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
zogalogran
Beginner


Joined: 23 Jun 2006
Posts: 20

PostPosted: Thu Jan 16, 2014 2:59 pm   

old friend: the mysql server has gone away error
 
I have struggled with this one for a long time, and have not found a satisfactory answer.

I have a some of fairly simple scripts accessing a mysql db. The open a connection, perform select/insert/update operations, close the connection, and unvar the db variable.

If I continue using the scripts fairly regularly (every 10-15 minutes or thereabouts) I don't seem to have an issue. If I go longer than that without accessing the db, I invariable get the mysql server has gone away error. At that point I have to close cmud and reopen it, and everything works again.

This mysql error can happen for a number of reasons, but my understanding is the most common reason is that a connection has remained open for too long and timed out. I could address this by changing the timeout settings on the database, but it's a shared db server and I don't have access to those settings.

Regardless, when I call db.close() it should close the connection! Is this a bug in CMUD? Is there something else I need to do to make sure that the connection is properly terminated and re-established each time?

Heaps of blessings on anyone who can offer insight. This has been driving me mad.

**EDIT** I asked my host what the wait_timeout on the server was set to and it's currently >8hrs. There has to be something funky going on in the way CMUD is handling the connection.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jan 16, 2014 10:49 pm   
 
It's how all telnet clients and similar applications (I assume remote db connections qualify as similar) work. They ask for a connection and they leave it running. If it idles for too long, Windows will come along and snatch it away without notification.

In a browser setting, the connection is asked for, used to completion (for downloading the page), and then returned to the OS. If you navigate further into the site or go to a different site altogether, a brand new connection is asked for instead of reusing an old one.
_________________
EDIT: I didn't like my old signature
Reply with quote
zogalogran
Beginner


Joined: 23 Jun 2006
Posts: 20

PostPosted: Fri Jan 17, 2014 3:14 pm   
 
Thanks Matt. Think I can use the tick timer to ping the db every 5 minutes or so?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net