SayText2 send() crashes server (LATEST BUILD)
SayText2 send() crashes server (LATEST BUILD)
So the builds from dec 21 (i estimate) crashes hole server when you .send the sayText2 obj
i would like a fix very quick, if possible
more accurate, crashes in _send_message method, after GameEngine.MessageEnd()
i would like a fix very quick, if possible
more accurate, crashes in _send_message method, after GameEngine.MessageEnd()
-Tuck
I'm using it without issue in SourceRPG. How are you using it? This is my code and it works fine:
-freddukes
Syntax: Select all
from messages import SayText2
from events import Event
from players.helpers import index_from_userid
class Player(object):
def __init__(self, index):
self.index = index
def send_message(self, message, index=None):
"""Sends a message to the player
@param str message A message to send
"""
message = SayText2(message, index if index is not None else self.index,
self.index)
message.send()
#### Events
@Event
def player_spawn(GameEvent):
userid = GameEvent.GetInt("userid")
index = index_from_userid(userid)
Player(index).send_message("Hello there")
-freddukes
example code that crashes:
Syntax: Select all
from Source import Player
from messages import SayText2
from events import Event
@Event
def player_say(GameEvent):
userid = GameEvent.GetInt('userid')
if int(userid or 0) > 0:
index = Player.IndexOfUserid(userid)
obj = SayText2('Testing 123', index, index)
obj.send()
-Tuck
Hmm I can't remember whether I'm running debug or release; I think I'm running debug. It could be an issue; usually debug does things like automatically initialise variables to 0 or some other value (sometimes a memory fill pattern like 0xCDCDCDCD) whereas release will usually just fill it with whatever exists at that address at that time. It can lead to random issues which won't replicate unless in release. Release also does things like function inlining, loop unrolling, code reordering etc which can also mess up flow and cause other issues which can be difficult to debug.
I'll run your code under a release build to see if I can replicate the crash.
-freddukes
I'll run your code under a release build to see if I can replicate the crash.
-freddukes
freddukes wrote:Hmm I can't remember whether I'm running debug or release; I think I'm running debug. It could be an issue; usually debug does things like automatically initialise variables to 0 or some other value (sometimes a memory fill pattern like 0xCDCDCDCD) whereas release will usually just fill it with whatever exists at that address at that time. It can lead to random issues which won't replicate unless in release. Release also does things like function inlining, loop unrolling, code reordering etc which can also mess up flow and cause other issues which can be difficult to debug.
I'll run your code under a release build to see if I can replicate the crash.
-freddukes
i build the release my self, not a official release being used.
Heres some information:
i could run debug if there was a option to include MSVCR100D.dll into the build or to place it next to srcds or something like that, i have to install visual studio 2010 before this file is located at the computer..
the #1 to #8 is basicly to debug which line crashes i've stated that in earlier post.
Quick note for how i build the release:
- Starting "source-python.sln" in Visual studio 2010 C++ Express
- Right click Solution -> Configuration Manager..
- Changin Active solution configuration, to "Release"
- Build solution
-Tuck
Heh... L'In20Cible and I were working on a fix; seems like release does some weird code removal on the destructor of MRecipientFilter... It seems it won't properly call the dtor unless there's a definition of it in the CPP (will not work if placed in the header :S).
I will do some more testing and check in a fix later on.
-freddukes
I will do some more testing and check in a fix later on.
-freddukes
freddukes wrote:Heh... L'In20Cible and I were working on a fix; seems like release does some weird code removal on the destructor of MRecipientFilter... It seems it won't properly call the dtor unless there's a definition of it in the CPP (will not work if placed in the header :S).
I will do some more testing and check in a fix later on.
-freddukes
Okay thanks , keep me updated :P
-Tuck
https://code.google.com/p/source-python/source/detail?r=ce753893a711fb0a3df3840dc06f62ae07f4b7e6
Getting latest should fix your crash. It's not a complete fix, I've still got to figure out why ShowMenu doesn't work (but SayText2 should now work in release).
From what I could understand, compiler optimisations caused the inline ctor / dtor to invoke a copy constructor on the CUtlVector which copied the heap memory allocator's pointer. When the copy was destroyed, it deleted the heap allocation which meant when the actual memory allocator was destroyed at the right time it attempted to free the memory at that heap location twice, causing a heap error. I have no idea why the optimisations caused this.
Big thanks to L'In20Cible for finding the original problem and proposing the fix.
-freddukes
Getting latest should fix your crash. It's not a complete fix, I've still got to figure out why ShowMenu doesn't work (but SayText2 should now work in release).
From what I could understand, compiler optimisations caused the inline ctor / dtor to invoke a copy constructor on the CUtlVector which copied the heap memory allocator's pointer. When the copy was destroyed, it deleted the heap allocation which meant when the actual memory allocator was destroyed at the right time it attempted to free the memory at that heap location twice, causing a heap error. I have no idea why the optimisations caused this.
Big thanks to L'In20Cible for finding the original problem and proposing the fix.
-freddukes
Seems like it crashes again, though not insantly. Few seconds after a message sent srcds crashes.
Libraries: k2tools
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm
If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm
If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
Omega_K2 wrote:Seems like it crashes again, though not insantly. Few seconds after a message sent srcds crashes.
I don't think you've been experiencing the same issue as i was, could you create a small script that crashes the server and put some debug messages in to figure what line/function/method crashes it, Also state if you compiled it as release or debug.
edit: if the crash happens a few seconds later figure out what method you called and maybe put some debug messages into the imported method used
Thanks in advance
-Tuck
yeah actually ingore it, I think the server just bugged when I tried this earlier.
EDIT: It could crash with a 100% chance pretty much whenever I tried it, it was just matter of executing client command, then showing the message, then waiting 1-10 secs for the crash. But no idea what caused it, server is just running SP and nothing else pretty much
EDIT: It could crash with a 100% chance pretty much whenever I tried it, it was just matter of executing client command, then showing the message, then waiting 1-10 secs for the crash. But no idea what caused it, server is just running SP and nothing else pretty much
Libraries: k2tools
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm
If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
Plugins (any): GSRPG (soon) | Pretty Status List | MySQLAds (soon)
Plugins (game-specific): None atm
If you happen to find a bug or need help, either post in the release threads or contact me in IRC gamesurge.net:6667 / #sourcepython
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 16 guests