logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Have NWNX2 and MySQL on Ubuntu 6.0 Error: DB went away!
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support
View previous topic :: View next topic  
Author Message
bsworkman



Joined: 20 Sep 2006
Posts: 18

PostPosted: Sun Oct 01, 2006 4:28    Post subject: Have NWNX2 and MySQL on Ubuntu 6.0 Error: DB went away! Reply with quote

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
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Sun Oct 01, 2006 10:05    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
bsworkman



Joined: 20 Sep 2006
Posts: 18

PostPosted: Sun Oct 01, 2006 17:55    Post subject: Reply with quote

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
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Oct 03, 2006 9:44    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Thu Oct 26, 2006 0:42    Post subject: Reply with quote

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
View user's profile Send private message
bsworkman



Joined: 20 Sep 2006
Posts: 18

PostPosted: Sun Nov 26, 2006 1:03    Post subject: Reply with quote

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
View user's profile Send private message
pdwalker



Joined: 09 Aug 2005
Posts: 22

PostPosted: Mon Nov 27, 2006 19:05    Post subject: Reply with quote

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
View user's profile Send private message
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Tue Nov 28, 2006 1:28    Post subject: Reply with quote

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
View user's profile Send private message
Jesterb769



Joined: 25 Aug 2006
Posts: 22

PostPosted: Tue Dec 12, 2006 23:29    Post subject: Reply with quote

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
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Dec 12, 2006 23:50    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Grumalg



Joined: 04 Nov 2005
Posts: 70

PostPosted: Wed Dec 13, 2006 4:11    Post subject: Reply with quote

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
View user's profile Send private message
bsworkman



Joined: 20 Sep 2006
Posts: 18

PostPosted: Thu Dec 14, 2006 4:00    Post subject: Reply with quote

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
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Thu Dec 14, 2006 6:57    Post subject: Reply with quote

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
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Thu Dec 14, 2006 7:55    Post subject: Reply with quote

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
View user's profile Send private message
bsworkman



Joined: 20 Sep 2006
Posts: 18

PostPosted: Sun Dec 17, 2006 18:02    Post subject: Reply with quote

Thanks!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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


Powered by phpBB © 2001, 2005 phpBB Group