Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
Yep, though this is a little slow-going since it requires a player connection / dedicated server to reproduce the issue. I see two different problems since the latest Valve update. I can obtain crash dumps if anyone is particularly keen on them. Yet, since the addon produces this on any Windows dedicated server I tried, this should be unnecessary. First was a crash and this is when srcds.exe was launched in GUI mode. It's a read access violaton on 0x0040: 0040() AdminServer.dll!025012d7() kernel32.dll!7c81eb33() AdminServer.dll!024db411() vstdlib.dll!00877101() AdminServer.dll!025012c6() AdminServer.dll!024cc89d() dedicated.dll!10004bd6() dedicated.dll!10018903() dedicated.dll!10018957() For a Windows console dedicated server, the crash appears to have morphed into an infinite loop that eats all the server CPU cycles-- not sure if the latest Valve update causes that or if trying to get a debugger involved has changed the nature of the problem slightly. -Mattie - Original Message - From: Daniel Jennings [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:24 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Have you run it through a debugger to check the stack when it crashes? - Original Message - From: Adam amckern Mckern [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 5:13 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash are your runing the lattest build of ded server, and have you thought of adding a break point? --- Mattie Casper [EMAIL PROTECTED] wrote: Events are caused within events all the time--- people use events to do all sorts of things: kick players, make people swap teams, teamkill punishment, etc. Even if server event reentrance is a problem, we need some Valve documentation saying this is forbidden or dangerous. To clarify three points: 1. I'm not interested in specifically kicking a player. I'm interested in doing X during an event where X is anything the administrator wants. So if he wants to kick a player that's his thing. I, personally, am not trying to kick anyone during an event. I'm letting people run semi-special config files during an event. 2. The crash doesn't just happen when plugin code specifically kicks someone. It can happen when a player is kicked via some administrative plugin, by the console, etc. It just needs to happen at the around the time an event calls ServerExecute. 3. The example below is the smallest example I made to reproduce the problem. I'm no newbie to coding-- I've considered all sorts of workarounds. Like scheduling things independently via GameFrame, avoiding the ServerExecute, etc. Unfortunately, these alternatives are substandard/messy and, really, I just need someone at Valve to say this is a bug, we'll fix it or ServerExecute during an event is unsupported because of X and we'll document it as such going forward. If I've missed existing documentation to this effect, I'm hoping someone on the list can point me to it. (Educated guesses stated as if they were fact won't help me, though.) Thanks, -Mattie cheeseh wrote: - I am guessing that when you kick a player another event is triggered that tells that the player was kicked/left the server. You cannot have two events fire inside each other, I am taking this from the old net message code that was from HL1, you could not have two messages start before they end. Instead of kicking the player there, try raising a flag (try storing a global boolean variable and the player id) and check it on startframe (or GameFrame () as it is now in HL2 I think) when the flag is true, kick the stored player id, then set the flag to false. In the event code replace it with setting the boolean to true and setting the playerid to the userid.- Original Message - From: Mattie Casper [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:25 AM Subject: FireGameEvent, kickid, ServerExecute, crash Hello, I've found what seems, for me, to be a really annoying bug in CSS (and probably mods). The following problem happens regardless of whether you use IGameEventListener or IGameEventListener2. My Windows server crashes 98% of the time with the following code in a listener/plugin: void CEmptyServerPlugin::FireGameEvent( IGameEvent * event ) { const char * name = event-GetName(); if (FStrEq(name, player_changename)) { if(tester_cvar.GetInt()==1) { Msg(Kicking ya.\n); int userid = event-GetInt(userid); char szMessage[1024]; sprintf(szMessage, kickid %d Go away.\n, userid); engine-ServerCommand(szMessage); if (tester2_cvar.GetInt()==1
RE: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
Looks like a null pointer is trying to be de-referenced. Have you stepped the code and verified that this is not the problem? - Alfred -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mattie Casper Sent: Sunday, March 27, 2005 10:20 AM To: hlcoders@list.valvesoftware.com Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Yep, though this is a little slow-going since it requires a player connection / dedicated server to reproduce the issue. I see two different problems since the latest Valve update. I can obtain crash dumps if anyone is particularly keen on them. Yet, since the addon produces this on any Windows dedicated server I tried, this should be unnecessary. First was a crash and this is when srcds.exe was launched in GUI mode. It's a read access violaton on 0x0040: 0040() AdminServer.dll!025012d7() kernel32.dll!7c81eb33() AdminServer.dll!024db411() vstdlib.dll!00877101() AdminServer.dll!025012c6() AdminServer.dll!024cc89d() dedicated.dll!10004bd6() dedicated.dll!10018903() dedicated.dll!10018957() For a Windows console dedicated server, the crash appears to have morphed into an infinite loop that eats all the server CPU cycles-- not sure if the latest Valve update causes that or if trying to get a debugger involved has changed the nature of the problem slightly. -Mattie - Original Message - From: Daniel Jennings [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:24 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Have you run it through a debugger to check the stack when it crashes? - Original Message - From: Adam amckern Mckern [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 5:13 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash are your runing the lattest build of ded server, and have you thought of adding a break point? --- Mattie Casper [EMAIL PROTECTED] wrote: Events are caused within events all the time--- people use events to do all sorts of things: kick players, make people swap teams, teamkill punishment, etc. Even if server event reentrance is a problem, we need some Valve documentation saying this is forbidden or dangerous. To clarify three points: 1. I'm not interested in specifically kicking a player. I'm interested in doing X during an event where X is anything the administrator wants. So if he wants to kick a player that's his thing. I, personally, am not trying to kick anyone during an event. I'm letting people run semi-special config files during an event. 2. The crash doesn't just happen when plugin code specifically kicks someone. It can happen when a player is kicked via some administrative plugin, by the console, etc. It just needs to happen at the around the time an event calls ServerExecute. 3. The example below is the smallest example I made to reproduce the problem. I'm no newbie to coding-- I've considered all sorts of workarounds. Like scheduling things independently via GameFrame, avoiding the ServerExecute, etc. Unfortunately, these alternatives are substandard/messy and, really, I just need someone at Valve to say this is a bug, we'll fix it or ServerExecute during an event is unsupported because of X and we'll document it as such going forward. If I've missed existing documentation to this effect, I'm hoping someone on the list can point me to it. (Educated guesses stated as if they were fact won't help me, though.) Thanks, -Mattie cheeseh wrote: - I am guessing that when you kick a player another event is triggered that tells that the player was kicked/left the server. You cannot have two events fire inside each other, I am taking this from the old net message code that was from HL1, you could not have two messages start before they end. Instead of kicking the player there, try raising a flag (try storing a global boolean variable and the player id) and check it on startframe (or GameFrame () as it is now in HL2 I think) when the flag is true, kick the stored player id, then set the flag to false. In the event code replace it with setting the boolean to true and setting the playerid to the userid.- Original Message - From: Mattie Casper [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:25 AM Subject: FireGameEvent, kickid, ServerExecute, crash Hello, I've found what seems, for me, to be a really annoying bug in CSS (and probably mods). The following problem happens regardless of whether you use IGameEventListener or IGameEventListener2. My Windows server crashes 98% of the time with the following code in a listener/plugin: void CEmptyServerPlugin::FireGameEvent
Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
Alfred Reynolds wrote: Looks like a null pointer is trying to be de-referenced. Have you stepped the code and verified that this is not the problem? If it's 0x40, it's not NULL, but it's still borked up! ;) -- Jeffrey botman Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
RE: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
0x40 looking like an offset into a null vtable :) - Alfred -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeffrey botman Broome Sent: Sunday, March 27, 2005 1:41 PM To: hlcoders@list.valvesoftware.com Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Alfred Reynolds wrote: Looks like a null pointer is trying to be de-referenced. Have you stepped the code and verified that this is not the problem? If it's 0x40, it's not NULL, but it's still borked up! ;) -- Jeffrey botman Broome ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
RE: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
Oh, and don't run ServerExecute(), you don't need to do that (it shouldn't crash anything, but it isn't appropriate for you to call that). - Alfred -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alfred Reynolds Sent: Sunday, March 27, 2005 1:23 PM To: hlcoders@list.valvesoftware.com Subject: RE: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Looks like a null pointer is trying to be de-referenced. Have you stepped the code and verified that this is not the problem? - Alfred -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mattie Casper Sent: Sunday, March 27, 2005 10:20 AM To: hlcoders@list.valvesoftware.com Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Yep, though this is a little slow-going since it requires a player connection / dedicated server to reproduce the issue. I see two different problems since the latest Valve update. I can obtain crash dumps if anyone is particularly keen on them. Yet, since the addon produces this on any Windows dedicated server I tried, this should be unnecessary. First was a crash and this is when srcds.exe was launched in GUI mode. It's a read access violaton on 0x0040: 0040() AdminServer.dll!025012d7() kernel32.dll!7c81eb33() AdminServer.dll!024db411() vstdlib.dll!00877101() AdminServer.dll!025012c6() AdminServer.dll!024cc89d() dedicated.dll!10004bd6() dedicated.dll!10018903() dedicated.dll!10018957() For a Windows console dedicated server, the crash appears to have morphed into an infinite loop that eats all the server CPU cycles-- not sure if the latest Valve update causes that or if trying to get a debugger involved has changed the nature of the problem slightly. -Mattie - Original Message - From: Daniel Jennings [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:24 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Have you run it through a debugger to check the stack when it crashes? - Original Message - From: Adam amckern Mckern [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 5:13 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash are your runing the lattest build of ded server, and have you thought of adding a break point? --- Mattie Casper [EMAIL PROTECTED] wrote: Events are caused within events all the time--- people use events to do all sorts of things: kick players, make people swap teams, teamkill punishment, etc. Even if server event reentrance is a problem, we need some Valve documentation saying this is forbidden or dangerous. To clarify three points: 1. I'm not interested in specifically kicking a player. I'm interested in doing X during an event where X is anything the administrator wants. So if he wants to kick a player that's his thing. I, personally, am not trying to kick anyone during an event. I'm letting people run semi-special config files during an event. 2. The crash doesn't just happen when plugin code specifically kicks someone. It can happen when a player is kicked via some administrative plugin, by the console, etc. It just needs to happen at the around the time an event calls ServerExecute. 3. The example below is the smallest example I made to reproduce the problem. I'm no newbie to coding-- I've considered all sorts of workarounds. Like scheduling things independently via GameFrame, avoiding the ServerExecute, etc. Unfortunately, these alternatives are substandard/messy and, really, I just need someone at Valve to say this is a bug, we'll fix it or ServerExecute during an event is unsupported because of X and we'll document it as such going forward. If I've missed existing documentation to this effect, I'm hoping someone on the list can point me to it. (Educated guesses stated as if they were fact won't help me, though.) Thanks, -Mattie cheeseh wrote: - I am guessing that when you kick a player another event is triggered that tells that the player was kicked/left the server. You cannot have two events fire inside each other, I am taking this from the old net message code that was from HL1, you could not have two messages start before they end. Instead of kicking the player there, try raising a flag (try storing a global boolean variable and the player id) and check it on startframe (or GameFrame () as it is now in HL2 I think) when the flag is true, kick the stored player id, then set the flag to false. In the event code replace it with setting the boolean to true and setting the playerid to the userid.- Original Message - From: Mattie Casper [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:25 AM Subject
Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
Alfred-- I have stepped through my code, but I haven't stepped through this particular callstack as I don't have any symbols for this. This is a Server Plugin for CSS. The code I provide below is very simple and it'd be easy for most anyone to reproduce. I can provide an entire sample project if someone is interested, but I'd be surprised if that was necessary. I actually do need to perform ServerExecute. Here's why: 1. The EventScripts plugin will execute an administrator's config file upon a particular event. (E.g. exec player_say.cfg, round_start.cfg, etc) 2. I provide some console commands that support expanding variables if those console commands are run within an event. These are event-specific variables (like what's provided in the IGameEvent, like userid, etc). 3. If those console commands aren't executed right away, the event information will be lost (or, potentially, leaked since I don't know when I need to stop expanding variables if I exit the event). For example, an administrator might provide a player_changename.cfg that performs something like this: es kickid event_var(userid). The 'es' console command will expand all strings that begin with event_var to be the value passed in with the IGameEvent. So this might expand to an immediate kickid 3 console command. (In this particular example, the server will crash much like the plugin sample I listed below.) I can't read these IGameEvent values if the event has already passed (without lots of pain and potential to break backwards compatibility for my users). Why is it inappropriate to call ServerExecute? It's used in other places within the SDK, particularly when loading config files (which is exactly what I'm doing). I'd really like to know why the call below crashes the server. Is there any additional information I can provide to help get the answer to this question? Thanks for any insight you can provide, and let me know if you have any difficulties reproducing the problem. -Mattie FYI-- Anyone interested in the minutae of EventScripts, which is growing in interest in the community: http://www.sourcemod.net/forums/viewtopic.php?t=908 - Original Message - From: Alfred Reynolds [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Sunday, March 27, 2005 4:49 PM Subject: RE: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Oh, and don't run ServerExecute(), you don't need to do that (it shouldn't crash anything, but it isn't appropriate for you to call that). - Alfred -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alfred Reynolds Sent: Sunday, March 27, 2005 1:23 PM To: hlcoders@list.valvesoftware.com Subject: RE: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Looks like a null pointer is trying to be de-referenced. Have you stepped the code and verified that this is not the problem? - Alfred -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mattie Casper Sent: Sunday, March 27, 2005 10:20 AM To: hlcoders@list.valvesoftware.com Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Yep, though this is a little slow-going since it requires a player connection / dedicated server to reproduce the issue. I see two different problems since the latest Valve update. I can obtain crash dumps if anyone is particularly keen on them. Yet, since the addon produces this on any Windows dedicated server I tried, this should be unnecessary. First was a crash and this is when srcds.exe was launched in GUI mode. It's a read access violaton on 0x0040: 0040() AdminServer.dll!025012d7() kernel32.dll!7c81eb33() AdminServer.dll!024db411() vstdlib.dll!00877101() AdminServer.dll!025012c6() AdminServer.dll!024cc89d() dedicated.dll!10004bd6() dedicated.dll!10018903() dedicated.dll!10018957() For a Windows console dedicated server, the crash appears to have morphed into an infinite loop that eats all the server CPU cycles-- not sure if the latest Valve update causes that or if trying to get a debugger involved has changed the nature of the problem slightly. -Mattie - Original Message - From: Daniel Jennings [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:24 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash Have you run it through a debugger to check the stack when it crashes? - Original Message - From: Adam amckern Mckern [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 5:13 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash are your runing the lattest build of ded server, and have you thought of adding a break point? --- Mattie Casper [EMAIL PROTECTED] wrote: Events are caused within events all the time--- people use events to do all sorts of things: kick players, make people swap teams, teamkill punishment, etc. Even if server event reentrance is a problem, we need some Valve
[hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
Events are caused within events all the time--- people use events to do all sorts of things: kick players, make people swap teams, teamkill punishment, etc. Even if server event reentrance is a problem, we need some Valve documentation saying this is forbidden or dangerous. To clarify three points: 1. I'm not interested in specifically kicking a player. I'm interested in doing X during an event where X is anything the administrator wants. So if he wants to kick a player that's his thing. I, personally, am not trying to kick anyone during an event. I'm letting people run semi-special config files during an event. 2. The crash doesn't just happen when plugin code specifically kicks someone. It can happen when a player is kicked via some administrative plugin, by the console, etc. It just needs to happen at the around the time an event calls ServerExecute. 3. The example below is the smallest example I made to reproduce the problem. I'm no newbie to coding-- I've considered all sorts of workarounds. Like scheduling things independently via GameFrame, avoiding the ServerExecute, etc. Unfortunately, these alternatives are substandard/messy and, really, I just need someone at Valve to say this is a bug, we'll fix it or ServerExecute during an event is unsupported because of X and we'll document it as such going forward. If I've missed existing documentation to this effect, I'm hoping someone on the list can point me to it. (Educated guesses stated as if they were fact won't help me, though.) Thanks, -Mattie cheeseh wrote: - I am guessing that when you kick a player another event is triggered that tells that the player was kicked/left the server. You cannot have two events fire inside each other, I am taking this from the old net message code that was from HL1, you could not have two messages start before they end. Instead of kicking the player there, try raising a flag (try storing a global boolean variable and the player id) and check it on startframe (or GameFrame () as it is now in HL2 I think) when the flag is true, kick the stored player id, then set the flag to false. In the event code replace it with setting the boolean to true and setting the playerid to the userid.- Original Message - From: Mattie Casper [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:25 AM Subject: FireGameEvent, kickid, ServerExecute, crash Hello, I've found what seems, for me, to be a really annoying bug in CSS (and probably mods). The following problem happens regardless of whether you use IGameEventListener or IGameEventListener2. My Windows server crashes 98% of the time with the following code in a listener/plugin: void CEmptyServerPlugin::FireGameEvent( IGameEvent * event ) { const char * name = event-GetName(); if (FStrEq(name, player_changename)) { if(tester_cvar.GetInt()==1) { Msg(Kicking ya.\n); int userid = event-GetInt(userid); char szMessage[1024]; sprintf(szMessage, kickid %d Go away.\n, userid); engine-ServerCommand(szMessage); if (tester2_cvar.GetInt()==1) { // Crashes the server engine-ServerExecute(); } } } } Basically, this silly code causes a player to get kicked immediately when he tries to change his name. He certainly does get kicked, but the server crashes immediately after. This is just the sample reproduction code, but the problem shows itself at a much deeper point in my EventScripts plugin when users are kicked in the middle of an event. It can happen at times regardless of whether the event handler is doing the kicking (i.e. another plugin or user could be kicking the player while my event handlers are firing). I believe it is a timing or threading issue because if I place a Windows Sleep(100) after the above ServerExecute call, the crash usually doesn't happen. Avoiding ServerExecute() is not really an option for me because I truly need the command (not necessarily kick) executed immediately (typically an exec of a cfg file). Regardless, the documentation places no caveats on when ServerExecute() can be called, so I haven't been afraid to do so when needed. Anyone have any recommendations or thoughts here? Thanks for your help, -Mattie ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
are your runing the lattest build of ded server, and have you thought of adding a break point? --- Mattie Casper [EMAIL PROTECTED] wrote: Events are caused within events all the time--- people use events to do all sorts of things: kick players, make people swap teams, teamkill punishment, etc. Even if server event reentrance is a problem, we need some Valve documentation saying this is forbidden or dangerous. To clarify three points: 1. I'm not interested in specifically kicking a player. I'm interested in doing X during an event where X is anything the administrator wants. So if he wants to kick a player that's his thing. I, personally, am not trying to kick anyone during an event. I'm letting people run semi-special config files during an event. 2. The crash doesn't just happen when plugin code specifically kicks someone. It can happen when a player is kicked via some administrative plugin, by the console, etc. It just needs to happen at the around the time an event calls ServerExecute. 3. The example below is the smallest example I made to reproduce the problem. I'm no newbie to coding-- I've considered all sorts of workarounds. Like scheduling things independently via GameFrame, avoiding the ServerExecute, etc. Unfortunately, these alternatives are substandard/messy and, really, I just need someone at Valve to say this is a bug, we'll fix it or ServerExecute during an event is unsupported because of X and we'll document it as such going forward. If I've missed existing documentation to this effect, I'm hoping someone on the list can point me to it. (Educated guesses stated as if they were fact won't help me, though.) Thanks, -Mattie cheeseh wrote: - I am guessing that when you kick a player another event is triggered that tells that the player was kicked/left the server. You cannot have two events fire inside each other, I am taking this from the old net message code that was from HL1, you could not have two messages start before they end. Instead of kicking the player there, try raising a flag (try storing a global boolean variable and the player id) and check it on startframe (or GameFrame () as it is now in HL2 I think) when the flag is true, kick the stored player id, then set the flag to false. In the event code replace it with setting the boolean to true and setting the playerid to the userid.- Original Message - From: Mattie Casper [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:25 AM Subject: FireGameEvent, kickid, ServerExecute, crash Hello, I've found what seems, for me, to be a really annoying bug in CSS (and probably mods). The following problem happens regardless of whether you use IGameEventListener or IGameEventListener2. My Windows server crashes 98% of the time with the following code in a listener/plugin: void CEmptyServerPlugin::FireGameEvent( IGameEvent * event ) { const char * name = event-GetName(); if (FStrEq(name, player_changename)) { if(tester_cvar.GetInt()==1) { Msg(Kicking ya.\n); int userid = event-GetInt(userid); char szMessage[1024]; sprintf(szMessage, kickid %d Go away.\n, userid); engine-ServerCommand(szMessage); if (tester2_cvar.GetInt()==1) { // Crashes the server engine-ServerExecute(); } } } } Basically, this silly code causes a player to get kicked immediately when he tries to change his name. He certainly does get kicked, but the server crashes immediately after. This is just the sample reproduction code, but the problem shows itself at a much deeper point in my EventScripts plugin when users are kicked in the middle of an event. It can happen at times regardless of whether the event handler is doing the kicking (i.e. another plugin or user could be kicking the player while my event handlers are firing). I believe it is a timing or threading issue because if I place a Windows Sleep(100) after the above ServerExecute call, the crash usually doesn't happen. Avoiding ServerExecute() is not really an option for me because I truly need the command (not necessarily kick) executed immediately (typically an exec of a cfg file). Regardless, the documentation places no caveats on when ServerExecute() can be called, so I haven't been afraid to do so when needed. Anyone have any recommendations or thoughts here? Thanks for your help, -Mattie ___ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders http://ammahls.com __ Do you Yahoo!?
Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash
Have you run it through a debugger to check the stack when it crashes? - Original Message - From: Adam amckern Mckern [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 5:13 PM Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash are your runing the lattest build of ded server, and have you thought of adding a break point? --- Mattie Casper [EMAIL PROTECTED] wrote: Events are caused within events all the time--- people use events to do all sorts of things: kick players, make people swap teams, teamkill punishment, etc. Even if server event reentrance is a problem, we need some Valve documentation saying this is forbidden or dangerous. To clarify three points: 1. I'm not interested in specifically kicking a player. I'm interested in doing X during an event where X is anything the administrator wants. So if he wants to kick a player that's his thing. I, personally, am not trying to kick anyone during an event. I'm letting people run semi-special config files during an event. 2. The crash doesn't just happen when plugin code specifically kicks someone. It can happen when a player is kicked via some administrative plugin, by the console, etc. It just needs to happen at the around the time an event calls ServerExecute. 3. The example below is the smallest example I made to reproduce the problem. I'm no newbie to coding-- I've considered all sorts of workarounds. Like scheduling things independently via GameFrame, avoiding the ServerExecute, etc. Unfortunately, these alternatives are substandard/messy and, really, I just need someone at Valve to say this is a bug, we'll fix it or ServerExecute during an event is unsupported because of X and we'll document it as such going forward. If I've missed existing documentation to this effect, I'm hoping someone on the list can point me to it. (Educated guesses stated as if they were fact won't help me, though.) Thanks, -Mattie cheeseh wrote: - I am guessing that when you kick a player another event is triggered that tells that the player was kicked/left the server. You cannot have two events fire inside each other, I am taking this from the old net message code that was from HL1, you could not have two messages start before they end. Instead of kicking the player there, try raising a flag (try storing a global boolean variable and the player id) and check it on startframe (or GameFrame () as it is now in HL2 I think) when the flag is true, kick the stored player id, then set the flag to false. In the event code replace it with setting the boolean to true and setting the playerid to the userid.- Original Message - From: Mattie Casper [EMAIL PROTECTED] To: hlcoders@list.valvesoftware.com Sent: Saturday, March 26, 2005 9:25 AM Subject: FireGameEvent, kickid, ServerExecute, crash Hello, I've found what seems, for me, to be a really annoying bug in CSS (and probably mods). The following problem happens regardless of whether you use IGameEventListener or IGameEventListener2. My Windows server crashes 98% of the time with the following code in a listener/plugin: void CEmptyServerPlugin::FireGameEvent( IGameEvent * event ) { const char * name = event-GetName(); if (FStrEq(name, player_changename)) { if(tester_cvar.GetInt()==1) { Msg(Kicking ya.\n); int userid = event-GetInt(userid); char szMessage[1024]; sprintf(szMessage, kickid %d Go away.\n, userid); engine-ServerCommand(szMessage); if (tester2_cvar.GetInt()==1) { // Crashes the server engine-ServerExecute(); } } } } Basically, this silly code causes a player to get kicked immediately when he tries to change his name. He certainly does get kicked, but the server crashes immediately after. This is just the sample reproduction code, but the problem shows itself at a much deeper point in my EventScripts plugin when users are kicked in the middle of an event. It can happen at times regardless of whether the event handler is doing the kicking (i.e. another plugin or user could be kicking the player while my event handlers are firing). I believe it is a timing or threading issue because if I place a Windows Sleep(100) after the above ServerExecute call, the crash usually doesn't happen. Avoiding ServerExecute() is not really an option for me because I truly need the command (not necessarily kick) executed immediately (typically an exec of a cfg file). Regardless, the documentation places no caveats on when