[Help] Way to see cause of crash ?

Please post any questions about developing your plugin here. Please use the search function before posting!
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

[Help] Way to see cause of crash ?

Postby existenz » Mon Apr 03, 2017 4:49 pm

Hey !

I have some crashs on my server Csgo.
Date : 2017-04-03 16:47:05.603396
OS : Linux-3.16.0-4-amd64-x86_64-with-debian-8.7
Game : csgo
SP version : 561
Server plugins:
00: Source.Python, (C) 2012-2016, Source.Python Team.
SP plugins:
00: advert
01: admin
02: download
03: map_cycle
04: map_config
05: noblock
06: resetscore, 1.0, https://venomz.fr/
07: showdamage
08: vip
09: warcraft


I have add -debug but nothing help me to see why it crashed.
I think it's due to Warcraft mod with conflict on different heroes and sometimes when a player disconect the server crash...

CRASH: Wed Mar 1 18:55:04 CET 2017
Start Line: ./srcds_linux -game csgo -console -usercon +map aim_ag_texture2 +ip 163.172.222.213 -port 27015 -maxplayers_override 16 -pidfile ogp_game_startup.p$
[New LWP 31159]
[New LWP 31161]
[New LWP 31170]
[New LWP 31173]
[New LWP 31177]
[New LWP 31184]
[New LWP 31186]
[New LWP 31190]
[New LWP 31660]
[New LWP 31183]
[New LWP 31171]
#0 0xf217c001 in ?? ()
End of Source crash report


Any other way to see the stacktrace of the crash ?
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: [Help] Way to see cause of crash ?

Postby Kill » Tue Apr 04, 2017 3:02 pm

add -debug to Your server's start options.
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Tue Apr 04, 2017 3:20 pm

I have already add it. But the return of my crash is that :

# IN DEBUG LOG
CRASH: Wed Mar 1 18:55:04 CET 2017
Start Line: ./srcds_linux -game csgo -console -usercon +map aim_ag_texture2 +ip 163.172.222.213 -port 27015 -maxplayers_override 16 -pidfile ogp_game_startup.p$
[New LWP 31159]
[New LWP 31161]
[New LWP 31170]
[New LWP 31173]
[New LWP 31177]
[New LWP 31184]
[New LWP 31186]
[New LWP 31190]
[New LWP 31660]
[New LWP 31183]
[New LWP 31171]
#0 0xf217c001 in ?? ()
End of Source crash report


No stacktrace, so any way to see why it crash ...
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: [Help] Way to see cause of crash ?

Postby Kill » Tue Apr 04, 2017 4:30 pm

Code: Select all

Start Line: ./srcds_linux -game csgo -console -usercon +map aim_ag_texture2 +ip 163.172.222.213 -port 27015 -maxplayers_override 16 -pidfile ogp_game_startup.p$


It's not showing, maybe see if there's some option in your OGP control that overwrites it?
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Tue Apr 04, 2017 5:19 pm

It generates debug.log and -debug is in start line. Maybe bad copy paste.

Start Line: ./srcds_linux -game csgo -console -usercon +map aim_ag_texture7 +ip 163.172.222.213 -port 27015 -maxplayers_override 14 -pidfile ogp_game_startup.pid +game_type 0 +game_mode 0 -tickrate 100 -debug
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Wed Apr 12, 2017 7:43 am

Any python library or something can help me to have a stacktrace instead of '[New LWP 31159]' in debug log ?
User avatar
Kill
Member
Posts: 88
Joined: Wed Aug 31, 2016 10:05 pm

Re: [Help] Way to see cause of crash ?

Postby Kill » Wed Apr 12, 2017 11:26 am

User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [Help] Way to see cause of crash ?

Postby iPlayer » Wed Apr 12, 2017 2:45 pm

sometimes when a player disconect the server crash

It's good that you have this info already, but the more info you have, the easier it will be to debug.

The point here is that you are unlikely to get any Python traceback in the crash case. You'll only get memory dumps which are useless. So to debug this issue, one needs to try the opposite approach - debugging Warcraft mod itself (if it's the cause of the crash).

Also be sure to run the very latest Source.Python build, as we've fixed some issues with EntityDictionary that leaded to crashes in some plugins.
PS Before updating to the latest SP build make a backup of your current one, because you might discover that your plugins are broken with the newest SP version. Just tell us what plugins conflict with the newest SP and I will fix them.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Wed Apr 12, 2017 2:53 pm

Thanks for your both answers :)

Nice ! I will update my Sp.

And if i have a crash between two heroes, it's the same just a memory dump no traceback ...
So i will debug but it's difficult because it's random :s.
It would have been simpler if there were tracebacks.
Last edited by existenz on Wed Apr 12, 2017 2:59 pm, edited 1 time in total.
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [Help] Way to see cause of crash ?

Postby iPlayer » Wed Apr 12, 2017 2:56 pm

Source.Python tries to prevent crashes and usually just raises Python exceptions. If there's any traceback, it should appear right before the crash.
What Warcraft mod do you use?
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Wed Apr 12, 2017 3:00 pm

I use the latest from Predz (https://github.com/Predz/SP-Warcraft-Mod), but i have modify it.
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Wed Apr 12, 2017 3:07 pm

For example sometimes when a player play this hero we have a crash, i don't know if it's when is jumps or hits somebody

Syntax: Select all

from random import randint

from engines.server import global_vars
from effects.base import TempEntity
from entities.entity import Entity
from filters.entities import EntityIter
from filters.players import PlayerIter
from filters.weapons import WeaponClassIter
from listeners.tick import Delay, Repeat
from mathlib import Vector
from messages import SayText2
from translations.strings import LangStrings

from . import Hero, Skill
from . import events

## TRANSLATIONS

strings = LangStrings('heroes/flame_predator')

_knifeonly = set(weapon.name for weapon in WeaponClassIter()) - {'weapon_knife', 'weapon_c4'}


class Flame_Predator(Hero):
name = 'Flame Predator'
description = 'Recoded Flame Predator from original WCS (Kryptonite).'
category = 'KNIFE'
cost = 0
required_level = 100

@classmethod
def meets_requirements(cls, player):
if global_vars.map_name in ('aim_deagle_simpsons', 'aim_r3volver', 'aim_deagle_revolution', 'scoutzknivez_oz20',):
return False
return True

@Flame_Predator.skill
class Predator(Skill):
name = 'Predator'
description = 'Predator only knife.'

@events('player_spawn')
def player_spawn(self, player, **eargs):
if player.team <= 1:
return
player.restrict_weapons(*_knifeonly)
for weapon in player.weapons(not_filters='knife'):
player.drop_weapon(weapon.pointer, None, None)


@Flame_Predator.skill
class Berserk(Skill):
name = 'Berserk'
description = 'More health and speed.'
max_level = 8

@events('player_spawn')
def _on_player_spawn(self, player, **eargs):
if self.level == 0:
return
player.health += 5 * self.level
player.speed = 1.4 + (0.05 * self.level)


@Flame_Predator.skill
class Cloak_of_Invisibility(Skill):
name = 'Cloak of Invisibility'
description = 'Put on your cloak to be 20-90% invisible.'
max_level = 8

@events('player_spawn')
def _on_player_spawn_give_invis(self, player, **eargs):
if self.level == 0:
return
color = player.color
color.a = 255 - (30 * self.level)
player.color = color


@Flame_Predator.skill
class Levitation(Skill):
name = 'Levitation'
description = 'Reduce your current gravity and damage taken when jumping.'
max_level = 8

@events('player_spawn')
def _on_player_spawn(self, player, **eargs):
player.gravity = 1 - 0.08 * self.level

@events('player_pre_victim')
def _on_player_pre_victim(self, attacker, victim, take_damage_info, **eargs):
if victim.ground_entity == -1 and self.level != 0:
take_damage_info.damage *= 1 - 0.06 * self.level
SayText2(
strings['Levitation Message 1'].get_string(
victim.language[:2], name=attacker.name)
).send(victim.index)
ricochet = TempEntity('Armor Ricochet', direction=victim.view_vector, position=victim.origin)
ricochet.create()


@Flame_Predator.skill
class Claw_Attack(Skill):
name = 'Claw Attack'
description = 'Force an enemy to drop his weapon when you attack him. 35%'
max_level = 8

@events('player_attack')
def _on_player_attack(self, attacker, victim, **eargs):
if randint(1, 100) > 35 or victim.active_weapon is None or self.level == 0:
return

victim.drop_weapon(victim.active_weapon)

SayText2(strings['Claw Attack Message 1'].get_string(attacker.language[:2], name=victim.name)
).send(attacker.index)
SayText2(strings['Claw Attack Message 2'].get_string(victim.language[:2], name=attacker.name)
).send(victim.index)


@Flame_Predator.skill
class Burning_Blade(Skill):
name = 'Burning Blade'
description = 'Set an enemy on fire when attacking him. 30%'
max_level = 8

@events('player_attack')
def _on_player_attack(self, attacker, victim, **eargs):
if randint(1, 100) > 30 or self.level == 0:
return

victim.ignite_lifetime(3)

SayText2(strings['Burning Blade Message 1'].get_string(attacker.language[:2], name=victim.name)
).send(attacker.index)
SayText2(strings['Burning Blade Message 2'].get_string(victim.language[:2], name=attacker.name)
).send(victim.index)
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [Help] Way to see cause of crash ?

Postby iPlayer » Wed Apr 12, 2017 3:12 pm

Okay, I'm looking into it
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Wed Apr 12, 2017 3:12 pm

Thanks :)
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [Help] Way to see cause of crash ?

Postby iPlayer » Wed Apr 12, 2017 4:12 pm

I haven't been able to reproduce the crash so far (with bots and alt account), so I request you to enhance the _on_disconnect_save_data function in warcraft/players.py this way:

Syntax: Select all

@Event('player_disconnect')
def _on_disconnect_save_data(event_data):
print("[debug] In PLAYER_DISCONNECT event")
player = players[event_data['userid']]
print("[debug] Got player")
save_player_data(player)
print("[debug] Saved player data")
save_hero_data(player)
print("[debug] Saved hero data")
del players[event_data['userid']]
print("[debug] Out of PLAYER_DISCONNECT event")


If/when the server crashes, look into the console to see if there are any of these debug messages.

I don't like how it passes a disconnected player to database-related functions which may some time become asynhronous and then the crashes are unavoidable.
Though, for now they're synchronous, so I don't understand what's crashing here. Me not being able to reprocude also doesn't help the case.
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [Help] Way to see cause of crash ?

Postby Ayuto » Wed Apr 12, 2017 4:23 pm

iPlayer wrote:The point here is that you are unlikely to get any Python traceback in the crash case. You'll only get memory dumps which are useless. So to debug this issue, one needs to try the opposite approach - debugging Warcraft mod itself (if it's the cause of the crash).

This is not quite correct. Adding the -debug option usually generates a stack trace of the called C/C++ functions. This often gives you a good hint where the server crashed. However, I'm not sure why the stack trace is missing in this case.

Source.Python rarely throws an exception before a crash happens. Actually, the only situation I can think of is this one:
https://github.com/Source-Python-Dev-Te ... #L119-L120

The most crashes that occur in Source.Python is when the memory module is being used with invalid data.
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Wed Apr 12, 2017 5:03 pm

@iPlayer
I will try to put your debug. But maybe the latest Sp solve this crash :)
But for heroes it's different, you think i must put debug in all heroes which can crash ?

@Ayuto
Why i haven't this error ?
A problem in Warcraft mod ?
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Re: [Help] Way to see cause of crash ?

Postby iPlayer » Wed Apr 12, 2017 5:06 pm

If you want to debug heroes as well - you might put such debug lines in heroes, too. You just have to know where to put it. But I thought that crash on player disconnect must be debugged first. See, I'm not a multi-task person in this matter :P
Image /id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam

Hail, Companion. [...] Hands to yourself, sneak thief. Image
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [Help] Way to see cause of crash ?

Postby Ayuto » Wed Apr 12, 2017 5:09 pm

existenz wrote:Why i haven't this error ?
A problem in Warcraft mod ?
Which error?
existenz
Senior Member
Posts: 111
Joined: Thu Feb 09, 2017 3:33 pm
Location: France
Contact:

Re: [Help] Way to see cause of crash ?

Postby existenz » Wed Apr 12, 2017 5:21 pm

@Ayuto
Sorry i mean :
Adding the -debug option usually generates a stack trace of the called C/C++ functions. This often gives you a good hint where the server crashed. However, I'm not sure why the stack trace is missing in this case.


@iPlayer
XD. I know :).
But this crash is random too.
I will put your debug bug i don't know when it crashes.
And i can't do this now on prod server with player on it :P

Return to “Plugin Development Support”

Who is online

Users browsing this forum: Bing [Bot] and 24 guests