View Full Version : Universal Chat crashing...
Grebbin
04-23-2011, 08:07 AM
Every so often my universal chat server will randomly crash on windows XP. The console window it is running in will hace a windows error window open on top of it with "an unknow errror has occured".. yada yada. Anyone have any ideas? It isn't critical to my server stability, but It annoys the heck out of me. It will work and stay open for several hours, but it will just kind of crash... Has anyone had similar problems or found a way to prevent it? I have my server reset daily at 4:45 am. It crashed some time between 12 pm and 11 pm after being up for over 7 hours.
Grebbin
04-23-2011, 11:43 PM
I think I have come up with a decent workaround to the universal chat crashing every 10 hours or so... I Have set up a batch file that will run on a four hour timer that shuts down universal chat and restarts it. Hopefully scheduled shutdowns and restarts will avoid the universal chat server unexpectedly crashing and staying down for several hours until the daily server reset. Anyone logged in will temporarily lose their universal chat when it restarts, but you should be able to reconnect by zoning.
sorvani
04-24-2011, 12:33 AM
There is another thread on this subject, but it did not have a solution either. Again only a workaround.
Think it was in the Linux forum.
Grebbin
04-24-2011, 01:23 AM
Thanks! I did some searching but most of the UCS issues were trouble connecting etc. I haven't really looked in the linnux forum much since I'm running windows, but thanks for pointing it out. I should probably head over there anyway to read up because I bet some of the issues are the same whether you are running windows or linnux. Thanks for the info!
Grebbin
04-27-2011, 11:24 PM
Regarding the issue of Universal chat running fine for a few hours and then crashing (popup error message over the console window)...
After 4 days of running my workaround, I'm happy to announce that my UCS hasn't crashed at all! Here is the solution I have come up with. First I created a batch file in notepad with the following lines:
tskill chatserver
ping -n 5 127.0.0.1 > nul
start chatserver.exe
exit
I then saved it as chatreboot.bat and put it in my eqemu server folder.
I then set it to run on a 4 hour timer:
In Windows XP:
Start->Programs->Accessories->System Tools->Scheduled Tasks
File->New->Scheduled Task
Right-Click your new task and select "properties"
Click "Browse" and find the batch file you just created.
If your computer isn't passworded, click the 'run only if logged in' checkbox.
Click the "Schedule" tab and enter the schedule as you see fit. I run mine on a 4 hour timer. I haven't really tested other intervals, since 4 hours seems to work well enough. Note that for more frequent than daily scheduling you'll need to go into the advanced settings.
Zothen
05-02-2011, 07:15 AM
I think I found the bug in UCS that is causing this crash.
Debugging showed up a halt in DBCore::Open() after a call of mysql_real_connect() using an uninitialized mysql struct.
The struct gets uninitialized whenever theres a connection error of some sort, because mysql.close() makes it invalid. Without another call to mysql.init() all following sql connects/commands will fail, resulting in a crash.
So we just need to enter a single line of code... :
(May need some more testing, but mine is running stable now for 20 hours.)
bool DBcore::Open(int32* errnum, char* errbuf) {
if (errbuf)
errbuf[0] = 0;
LockMutex lock(&MDatabase);
if (GetStatus() == Connected)
return true;
if (GetStatus() == Error)
{
mysql_close(&mysql); // <- Makes struct 'mysql' invalid!
mysql_init(&mysql); // <- Initialize structure again
}
if (!pHost)
return false;
/*
Quagmire - added CLIENT_FOUND_ROWS flag to the connect
otherwise DB update calls would say 0 rows affected when the value already equalled
what the function was tring to set it to, therefore the function would think it failed
*/
int32 flags = CLIENT_FOUND_ROWS;
if (pCompress)
flags |= CLIENT_COMPRESS;
if (pSSL)
flags |= CLIENT_SSL;
// crashed here, because 'mysql' wasnt valid after an error followed by mysql.close()
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
pStatus = Connected;
return true;
}
else {
if (errnum)
*errnum = mysql_errno(&mysql);
if (errbuf)
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
pStatus = Error;
return false;
}
}
Grebbin
05-07-2011, 01:50 PM
Probably a MUCH better solution"
Shiny151
05-09-2011, 11:50 AM
Zothen, has this been committed?
Zothen
05-09-2011, 12:03 PM
Aye :)
http://www.eqemulator.org/forums/showthread.php?t=33446
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.