Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2011, 08:07 AM
Grebbin
Sarnak
 
Join Date: Apr 2011
Posts: 32
Default Universal Chat crashing...

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.
Reply With Quote
  #2  
Old 04-23-2011, 11:43 PM
Grebbin
Sarnak
 
Join Date: Apr 2011
Posts: 32
Default Possible solution....

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.
Reply With Quote
  #3  
Old 04-24-2011, 12:33 AM
sorvani
Dragon
 
Join Date: May 2010
Posts: 965
Default

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.
Reply With Quote
  #4  
Old 04-24-2011, 01:23 AM
Grebbin
Sarnak
 
Join Date: Apr 2011
Posts: 32
Thumbs up

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!
Reply With Quote
  #5  
Old 04-27-2011, 11:24 PM
Grebbin
Sarnak
 
Join Date: Apr 2011
Posts: 32
Default Prevent UCS from crashing in windows XP

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.
Reply With Quote
  #6  
Old 05-02-2011, 07:15 AM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

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.)

Code:
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;
	}
}
Reply With Quote
  #7  
Old 05-07-2011, 01:50 PM
Grebbin
Sarnak
 
Join Date: Apr 2011
Posts: 32
Default

Probably a MUCH better solution"
Reply With Quote
  #8  
Old 05-09-2011, 12:03 PM
Zothen
Hill Giant
 
Join Date: Apr 2011
Location: Germany
Posts: 163
Default

Aye

http://www.eqemulator.org/forums/showthread.php?t=33446
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:41 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3