A little question about the event_state system

10/30/2012 18:24 c1ph3r#1
Hey everyone,

in the last weeks i wrote a custom event_buff system. It will give or remove buffs connected with special events on the server.

The whole system is working very fine. But after about 12-24 hours the server crashes or no it do not crash it's like the 7.4 bug at the beginning. Everything freezes and nobody can login.

I played around with the whole system and finally it looks like the freezes are caused by the event_states.

I'm only interested if somebody is fighting with the same problems by using one, a few or all of the following commands about 10 times in one hour.

add_event_state
remove_event_state
get_event_state_list
clear_event_state

At the moment the server freezes

-nobody is able to do something ingame
-i'm able to kick player via CaptainHerlockServer
-i'm able to execute gamecommands
-BUT the moment i use one of the event_state commands the server won't response anymore

After hours of trying around with that shit i wrote a workaround and now everything is working fine. But i'm interested if someone found a solution for this issue.
10/31/2012 06:46 misterd#2
Correct me if iam wrong, but these commands ware made to execute just fine as in official since our servers are official.

Only causes might be :

- the script has an deadlock ( turning your game into a freeze and trying to update same time )
- the database threads are unable to handle the situation, as they get updated
- Perhaps the script passes ingame-flags? check these for sure.


could you maybe provide more information?

anyway,

to me it looks like something that has been recently putted in or edited, caused this problem for you. either that or an flag is missing.

hope i helped you out a lil.
10/31/2012 11:35 TheChinStrap#3
I hope I'm understanding the problem correctly...

Do you have event states in a series of lua functions such as the following?
Code:
function event_buffs()
	add_event_state(2506, 41, 900000)
	add_event_state(2508, 41, 900000)
	add_event_state(163429, 10, 900000)
	add_event_state(13425, 277, 900000)
	add_event_state(13424, 277, 900000)
	add_event_state(13423, 36, 900000)
	add_event_state(163448, 39, 900000)
	add_event_state(2505, 160, 900000)
	add_event_state(2507, 160, 900000)
	add_event_state(163433, 90, 900000)
	add_event_state(163405, 48, 900000)
	add_event_state(163407, 48, 900000)
	add_event_state(163406, 48, 900000)
	add_event_state(163404, 48, 900000)
	add_event_state(1013, 100, 900000)
end
Or do you have a list in a self written program which you're firing under specific conditions, etc?

The reason i ask is, I had a simple program written in c# which punched in event states under certain conditions which it read from a list. I had issues with it freezing when there were too many commands sent to it at one time.
E.G:
Code:
foreach(string line in lines)
{
	foreach (Process herlock in Process.GetProcessesByName("CaptainHerlockServer"))
	{
		string text = eventBuffList[1];
		IntPtr p = Marshal.StringToHGlobalAuto(text);
		IntPtr tmp = FindWindowEx(herlock.MainWindowHandle, IntPtr.Zero, "Edit", null);
		SendMessage(tmp, WM_SETTEXT, 0, p);
		SendMessage(tmp, 258, 13, IntPtr.Zero);
		Application.DoEvents();
	}
}
It would work fairly well, until there were too many in the list then Herlock would lock up.

But once I added
Code:
System.Threading.Thread.Sleep(100);
in the code block or switched to lua functions the issue was corrected.

Hope that helped, mate.