View previous topic :: View next topic |
Author |
Message |
bsworkman
Joined: 20 Sep 2006 Posts: 18
|
Posted: Sun Oct 01, 2006 4:28 Post subject: Have NWNX2 and MySQL on Ubuntu 6.0 Error: DB went away! |
|
|
Hello,
I am getting a Error: DB went away error message on my Ubuntu Linux based system. I am running two Database scripts on my module. The modules are Salandra's ATS Crafting and ID Player Tracking. They use different Tables in the NWN Database. All works fine, then after awhile I get the DB went away error message.
Please Help.
-Brian. |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun Oct 01, 2006 10:05 Post subject: |
|
|
Please post the relevant section of your nwnx log file. Where does that message come from and where is it beeing displayed ? _________________ Papillon |
|
Back to top |
|
|
bsworkman
Joined: 20 Sep 2006 Posts: 18
|
Posted: Sun Oct 01, 2006 17:55 Post subject: |
|
|
The message
Error: DB went away!
Is displayed on the server command line and repeats every second or two.
The server command line in the terminal.
As far as logs, I guess I'm still a bit of a Newbie with NWNX and so far
havent need to use the logs for anything.
I'm just seeing a bunch of blank logs in Logs.0 Folder. Do it need to turn them on in the NWNX.INI or somethinig?
I'll post them as soon as I can find them. Thanks!
-Brian. |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Tue Oct 03, 2006 9:44 Post subject: |
|
|
I checked the source code, and the error message is generated after checking the database connection, using the mysql_ping command.
According to the mysql documentation, this means that either the connection to the database server has been lost, or the mysql server itself has stopped operation. _________________ Papillon |
|
Back to top |
|
|
Jesterb769
Joined: 25 Aug 2006 Posts: 22
|
Posted: Thu Oct 26, 2006 0:42 Post subject: |
|
|
I am also having this problem occassionally, though not on a regular/predictable basis. Any thoughts on what might cause this? _________________ Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin |
|
Back to top |
|
|
bsworkman
Joined: 20 Sep 2006 Posts: 18
|
Posted: Sun Nov 26, 2006 1:03 Post subject: |
|
|
Jester,
Just curious what version of MySql are you using?
I never had to restart the MySQL server, just the NWNX interface so I believe that my issue has to be a connection loss issue. The database never stops according to the logs that I can see. |
|
Back to top |
|
|
pdwalker
Joined: 09 Aug 2005 Posts: 22
|
Posted: Mon Nov 27, 2006 19:05 Post subject: |
|
|
It sounds like the database connection is being closed, usually because it is idle.
Mysql tends to do that.
Is inactivity a potential source of the problem? If so, you might want to do something to ensure that something uses the database connection before the server decides to close the connection as idle.
Just a guess.
- Paul |
|
Back to top |
|
|
Jesterb769
Joined: 25 Aug 2006 Posts: 22
|
Posted: Tue Nov 28, 2006 1:28 Post subject: |
|
|
I believe I'm running MySQL 5.0.22, and yes, there would be long periods of inactivity I believe... so that might be causing it. Is there any way to make it not shut down due to inactivity? Also, it happens multiple times in a row sometimes... so is it restarting itself, then shutting down again? Because I suppose as long as it restarts itself when it needs to be used, it doesn't really matter _________________ Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin |
|
Back to top |
|
|
Jesterb769
Joined: 25 Aug 2006 Posts: 22
|
Posted: Tue Dec 12, 2006 23:29 Post subject: |
|
|
A little more info on this...
It looks like the MySQL server never stops running, so it must be the NWNX->MySQL connection thats stopping. The error itself isn't happening *when* the connection is lost... just when someone tries to activate something in-game that would use the connection to the database.
Since I am a complete newbie to writing commands for MySQL... anyone have an ideas for how to write a short script that would just check someone on the database every X amount of time (5 minutes?)... in order to keep the connection active? _________________ Jester the Occasionally Merciful
World of Raathi
Creative Director/Admin |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Tue Dec 12, 2006 23:50 Post subject: |
|
|
I would issue a
SELECT 1
every odd minute or so.
Btw, I read about similar problems in the meantime in the context of a web development framework (totally unrelated to NWNX). The suggested solution was the same, i.e. sending keep-alive statements. _________________ Papillon |
|
Back to top |
|
|
Grumalg
Joined: 04 Nov 2005 Posts: 70
|
Posted: Wed Dec 13, 2006 4:11 Post subject: |
|
|
I haven't dug into that aspect with MySQL, but with many DB engines you can specify a timeout interval when establishing a connection. A timeout value of 0 often means never timeout.
Not something an end user can do much about, but someone doing a port of nwnx may be able to do something about this.
--- Grumalg --- |
|
Back to top |
|
|
bsworkman
Joined: 20 Sep 2006 Posts: 18
|
Posted: Thu Dec 14, 2006 4:00 Post subject: |
|
|
How would you code that Select 1 statement for every odd minute if you don't mind me asking. I'm not sure what script I would put that in. |
|
Back to top |
|
|
FunkySwerve
Joined: 02 Jun 2005 Posts: 377
|
Posted: Thu Dec 14, 2006 6:57 Post subject: |
|
|
In your mod heartbeat:
Code: |
#include "aps_include"
void main()
{
int nTime = GetLocalInt(OBJECT_SELF,"uptime");
nTime = nTime + 5;//changed from 6 because server firing hb every 5.012 seconds
SetLocalInt(OBJECT_SELF,"uptime", nTime);
if (!(nTime%60)) SQLExecDirect("SELECT 1");
}
|
You will want to add either 5 or 6 depending on how fast your mod heartbeat fires, but this will fire a SELECT 1 statement to the database roughly every 60 seconds.
Funky |
|
Back to top |
|
|
Grinning Fool
Joined: 12 Feb 2005 Posts: 264
|
Posted: Thu Dec 14, 2006 7:55 Post subject: |
|
|
Could also do this on mod load:
Code: |
#include "aps_include"
void KeepAlive()
{
SQLExecDirect("SELECT 1");
DelayCommand(60.0, KeepAlive());
}
main()
{
AssignCommand(OBJECT_SELF, KeepAlive());
}
|
_________________ Khalidine, a NWN2 persistent world
Looking for volunteers. |
|
Back to top |
|
|
bsworkman
Joined: 20 Sep 2006 Posts: 18
|
Posted: Sun Dec 17, 2006 18:02 Post subject: |
|
|
Thanks!!! |
|
Back to top |
|
|
|