Crashes upon map change.
Crashes upon map change.
Hey, have been playing with SP for a while now and have come across quite a large problem when using my dedicated server. The server is running Linux and am using the latest March 8th release. Server is running currently CSGO and CSS servers, however this problem only occurs on CSGO. Basically anytime a plugin is loaded and a map change happens, the individual server just crashes. No error logs I can find, instead it just restarts from the default map. If there aren't any plugins loaded then there is no problem changing map. Any help would be appreciated!
Have been testing using Hero Wars and some custom scripts, will share if you require to see them
Thanks All!
Have been testing using Hero Wars and some custom scripts, will share if you require to see them
Thanks All!
Have you tried narrowing it down to which script is causing the crashing? We can't really help until you have at least done that. Remove just the HeroWars plugin and see if the crashing continues. If it still crashes, continue removing plugins until you have narrowed it down.
My first guess would be that you have a known crashing issue. That issue is if you are hooking an event and also fire a new event from within an event being called. If I find the thread where this is discussed, I will edit it into this post.
*Edit: found it http://forums.sourcepython.com/showthread.php?582
My first guess would be that you have a known crashing issue. That issue is if you are hooking an event and also fire a new event from within an event being called. If I find the thread where this is discussed, I will edit it into this post.
*Edit: found it http://forums.sourcepython.com/showthread.php?582
- L'In20Cible
- Project Leader
- Posts: 1534
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
Np, this is the shortest script that still causes the problem. Even with only this loaded I still get crashes ;s
Edit: Also I just tried changing the map using "changelevel" in console however it doesn't seem to cause a crash, only when a map ends due to time/rounds/etc.
Syntax: Select all
##
##
##
from commands import CommandReturn
from commands.say import SayFilter
from messages import SayText2
from paths import PLUGIN_PATH
from translations.strings import LangStrings
##
##
##
strings = LangStrings('tags/tags')
@SayFilter
def say_filter(playerinfo, teamonly, command):
steamid = playerinfo.get_networkid_string()
if command.get_arg_string() == '""':
return CommandReturn.CONTINUE
if not '{0} {1}'.format(steamid, 'Text') in strings:
text = strings['Default Text'].get_string('en', text=command.get_arg_string().replace('"', ''))
name = strings['Default Name'].get_string('en', name=playerinfo.get_name())
message = '{name} : {text}'.format(name=name, text=text)
SayText2(message=message).send()
return CommandReturn.BLOCK
text = strings['{0} {1}'.format(steamid, 'Text')].get_string('en', text=command.get_arg_string().replace('"', ''))
name = strings['{0} {1}'.format(steamid, 'Name')].get_string('en', name=playerinfo.get_name())
message = '{name} : {text}'.format(name=name, text=text)
SayText2(message=message).send()
return CommandReturn.BLOCK
Edit: Also I just tried changing the map using "changelevel" in console however it doesn't seem to cause a crash, only when a map ends due to time/rounds/etc.
KK Sorry, HW was loaded when I was testing and the problem lies in HW, just me not paying attention to my logs ;s
I have found this but I have no clue what it means.
I have found this but I have no clue what it means.
Syntax: Select all
[SP] Loading plugin 'hw'...
[SP] Successfully loaded plugin 'hw'.
---- Host_Changelevel ----
*** Map Load: de_dust: Map Group mg_bombKeyValues Error: LoadFromBuffer: missing { in file gamemodes_server.txt
KeyValues Error: LoadFromBuffer: missing { in file gamemodes_server.txt
KeyValues Error: LoadFromBuffer: missing { in file gamemodes_server.txt
KeyValues Error: LoadFromBuffer: missing { in file gamemodes_server.txt
GameTypes: missing mapgroupsSP entry for game type/mode (custom/custom).
- L'In20Cible
- Project Leader
- Posts: 1534
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
The problem is inside Hero Wars, however there is a lot to check, so not to sure where to start.
Hero Wars
Hero Wars
I have been looking through the HeroWars code, and I don't see any event hooking already in-place. However, yes, if you have other plugins that have event hooking, calling another event from within an event (like line 495) will cause crashing.
Though, looking at that thread I posted again, it is stated to only happen on Windows. I have not personally tested that crash with Linux, but maybe it does occur there, too. I will test and report back. I do for a fact know that it will on Windows.
Though, looking at that thread I posted again, it is stated to only happen on Windows. I have not personally tested that crash with Linux, but maybe it does occur there, too. I will test and report back. I do for a fact know that it will on Windows.
By "still crashes", what exactly have you tried? Does that mean you have tried not loading Hero Wars, and then subsequently removing other scripts until you narrow down which one(s) are causing the crashing? Have you removed 'all' SP plugins and are still crashing? What other plugins (MetaMod, SourceMod, SM plugins, etc..) are on your server, and have you tried removing them as well?
- L'In20Cible
- Project Leader
- Posts: 1534
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
- L'In20Cible
- Project Leader
- Posts: 1534
- Joined: Sat Jul 14, 2012 9:29 pm
- Location: Québec
I think I found a possible cause of the crashes you are encountering. The problem here is that _Player instances are stored by their userid in a global list (player_list). While their userid won't change on new maps, their _playerinfo, _pointer and _edict instances are reallocated (normal, new "player" entities are created) and since those are cached in the Player/BaseEntity classes, you are randomly crashing at map changes cause those addresses are freed and accessing them later on is resulting in unexpected behaviors. This is a design issue on our ends to cache those, though. However, add the following to your players.py:
Syntax: Select all
from listeners import LevelInit
@LevelInit
def level_init(map_name):
global player_list
player_list = list()
Thanks for the help everyone however this hasn't seemed to of fixed the problem. I have had a look through the code and can't see any issues like you describe Doldol.
L'In, I have had -condebug on all the time, so the console.log below. Sorry there a couple of python errors because I was seeing if the materials were giving problems.
Sorry, had to be zipped as was to large to upload on website.
L'In, I have had -condebug on all the time, so the console.log below. Sorry there a couple of python errors because I was seeing if the materials were giving problems.
Sorry, had to be zipped as was to large to upload on website.
- Attachments
-
- LOG.zip
- (3.41 KiB) Downloaded 440 times
I am debugging it right now. It definitely crashes when it gets to this line:
https://github.com/Hero-Wars-Dev-Team/Hero-Wars/blob/master/addons/source-python/plugins/hw/hw.py#L211
So, somewhere in the get_player function is where it crashes. I would imagine L'In20Cible is correct, that it is caused by accessing either the player's IPlayerInfo or edict_t instance.
Also, since we are using Python3, I would change that LevelInit to simply be:
However, instead of the current implementation that uses a list, I would much rather use a dictionary class to store player's by their userid. Then, on LevelShutdown, I would clear the dictionary:
I get that caching the IPlayerInfo, edict_t, and pointer objects can cause crashing when access is attempted when the player (or entity) is no longer on the server. However, not caching them would cause us to have to get each of those instances constantly. I think with proper techniques, you can very easily avoid crashing with the current caching system.
https://github.com/Hero-Wars-Dev-Team/Hero-Wars/blob/master/addons/source-python/plugins/hw/hw.py#L211
So, somewhere in the get_player function is where it crashes. I would imagine L'In20Cible is correct, that it is caused by accessing either the player's IPlayerInfo or edict_t instance.
Also, since we are using Python3, I would change that LevelInit to simply be:
Syntax: Select all
from listeners import LevelInit
@LevelInit
def level_init(map_name):
player_list.clear()
However, instead of the current implementation that uses a list, I would much rather use a dictionary class to store player's by their userid. Then, on LevelShutdown, I would clear the dictionary:
Syntax: Select all
class PlayerDictionary(dict):
def __missing__(self, userid):
value = self[userid] = PlayerEntitySubClass(index_from_userid(userid))
return value
def __delitem__(self, userid):
if userid in self:
super(PlayerDictionary, self).__delitem__(userid)
player_dictionary = PlayerDictionary()
@LevelShutdown
def level_shutdown():
player_dictionary.clear()
I get that caching the IPlayerInfo, edict_t, and pointer objects can cause crashing when access is attempted when the player (or entity) is no longer on the server. However, not caching them would cause us to have to get each of those instances constantly. I think with proper techniques, you can very easily avoid crashing with the current caching system.
I have absolutely no clue how to fix this so I have just made a small fix for the meantime. I know it isn't very efficient, and probably a bad idea, so don't judge please. I just need some sort of minor fix so I can test server with people on :D
Syntax: Select all
##
##
##
from os.path import dirname
from engines.server import engine_server
from listeners import LevelShutdown, LevelInit
##
##
##
with open(dirname(__file__) + '/plugins.txt') as f:
lines = f.readlines()
plugins = list(lines)
##
##
##
@LevelInit
def level_init(map_name):
for plugin in plugins:
engine_server.server_command('sp load {0}'.format(plugin))
@LevelShutdown
def level_shutdown():
for plugin in plugins:
engine_server.server_command('sp unload {0}'.format(plugin))
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 25 guests