Raised This Month: $ Target: $400
 0% 

My script crashes our server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jernau
Junior Member
Join Date: Jul 2007
Old 07-12-2007 , 17:50   My script crashes our server
Reply With Quote #1

I've converted my map vote script from Eventscripts into Sourcemod and every so often it crashes our server. I wonder if someone would be able to take a look at the code and tell me what i'm doing wrong

The code for the script is available here : http://download.playerofgames.net/pievote.zip

In a nutshell the script connects to a MySQL database, inserts map names for the .bsp files it finds in the maps directory, waits a while to show a vote menu, collects all of the votes, then works out the winning map. This works fine for X rounds, then the server falls over and restarts.

I've tracked the problem down to the voteMapPanelHandler which handles the selected responses from the vote menu - when i was testing i selected a map from the menu and the server crashed. My problem is i can't track down exactly where it goes wrong or what bit of code is failing.

I altered the PrintToChatAll function in halflife.inc to call LogToGame for every message that the script produces, but when the server crashes the current logfile is zero bytes. Is there a way i can log directly to the sourcemod logfile so i can trace for errors, or should i be doing something else to trace and debug?

Our server runs on a dedicated Win2k3 machine and runs Mani, Eventscripts and Sourcemod. It's 100% stable at the moment because i've removed this script and gone back to the eventscripts version (the ES version causes half a second worth of freeze when it builds the popup menu which is why i've rewritten it).

Hopefully i'm just not releasing one of the timer handles or the vote panel handle correctly, but i can't see where.

Any help most appreciated!

Edit : mdmp files are available on request if this isn't just me being a noob

Last edited by Jernau; 07-12-2007 at 18:02.
Jernau is offline
BAILOPAN
Join Date: Jan 2004
Old 07-13-2007 , 11:39   Re: My script crashes our server
Reply With Quote #2

Half a second of freeze, oh dear ;)

We can definitely use the .mdmps as long as you know what version of SourceMod they crashed against. If the problem ends up being too complicated for an mdmp I might have to give you a special logging binary if you don't mind.
__________________
egg
BAILOPAN is offline
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 07-13-2007 , 11:55   Re: My script crashes our server
Reply With Quote #3

Try LogMessage instead of LogToGame. Game log files are buffered and don't finish being written out if it crashes. I'm not sure about SourceMod logs...
__________________
I'm a blast from the past!
ferret is offline
ferret
SourceMod Developer
Join Date: Dec 2004
Location: Atlanta, GA
Old 07-13-2007 , 11:57   Re: My script crashes our server
Reply With Quote #4

Code:
if (action == MenuAction_Select && param1 > 0 && param2 > 0)
As info, param1 will never be 0 in MenuAction_Select. However, param2 WILL be 0. 0 is the first option on the menu (1. Name)

param2 is the menu item index, not the value of the choice. You'll need to use GetMenuItem with param2 to get the actual value.

Edit: Nm, you seem to realize that. I just don't quite understand why you're storing some of the things you store in the database. You really should look at Menus and Votes. They handle counting the number of votes automatically, and automatically end the vote for you without he need of a timer.

You should take a look at this plugin, it does similar to what you seem to be after, but without MySQL: http://forums.alliedmods.net/showthread.php?t=56714
__________________
I'm a blast from the past!

Last edited by ferret; 07-13-2007 at 12:03.
ferret is offline
Jernau
Junior Member
Join Date: Jul 2007
Old 07-13-2007 , 19:49   Re: My script crashes our server
Reply With Quote #5

Here are two mdumps from our server which is running sourcemod-r1094.

http://download.playerofgames.net/tw...emod-r1094.zip

I'd be more than happy to run a different binary if it will help track down what's going on

I'll certainly try the LogMessage function, good tip for the future. Thought about that today and another method would be to create a log table within the MySQL database and insert information into that - definately slower than logging to file but at least i'd get the logs

I added the param1 and param2 checks to the if statement out of desparation, simply because i couldn't tell what parameters were being passed to the menu handler. The reason for not using the vote style menu is i'd like to be able to give the admins on the server a weighted vote over non-admins (so they'll get 1.5 votes against a map rather than the public player's 1). I store the votes each player makes into a table to give them a chance to change their vote - the ES version allows players to type !revote which brings up the vote popup again. The script populates the maps which will be voted on at the start of the map to allow people to !nominate additional maps to appear in the vote list. See, there's method in my madness

Must admit i downloaded Mapchooser a few days ago just to see how the professionals do it The tests in my script for INVALID_HANDLE are there because you have it in yours - i just hoped that i'd missed some cleanup that i needed to do

The short lag on popup creation in the ES version became a standing joke on our server - the players named it "vote lag" and it was getting embarassing Eventscripts has been very good to me tho and my ZapDM mod (http://maps.playerofgames.net/) is written in that, although once i get time i'll be converting that to SM too.

Many thanks for your help guys!
Jernau is offline
BAILOPAN
Join Date: Jan 2004
Old 07-14-2007 , 10:54   Re: My script crashes our server
Reply With Quote #6

You have a very interesting crash that I am really interested in tracking down once and for all. I am going to cook you up a quick binary that will save a lot more data in the minidump.
__________________
egg
BAILOPAN is offline
BAILOPAN
Join Date: Jan 2004
Old 07-14-2007 , 13:39   Re: My script crashes our server
Reply With Quote #7

Upgrade your dlls to r1116, then install the .dll from the zip file below. This is a very specific developer version of SourceMod that will output ~70-100MB .mdmp files. They're big but they have all the info we'll need to debug.

Thanks!
Attached Files
File Type: zip sm-r1116-debug-dev.zip (2.75 MB, 145 views)
__________________
egg

Last edited by BAILOPAN; 07-14-2007 at 13:47.
BAILOPAN is offline
Jernau
Junior Member
Join Date: Jul 2007
Old 07-14-2007 , 15:02   Re: My script crashes our server
Reply With Quote #8

Do you have a copy of windows r1116 available? The autobuild is showing r1117 I've been out in the sun all day and have only just seen this post
Jernau is offline
BAILOPAN
Join Date: Jan 2004
Old 07-14-2007 , 15:07   Re: My script crashes our server
Reply With Quote #9

You can use anything higher than 1116 as well.
__________________
egg
BAILOPAN is offline
Jernau
Junior Member
Join Date: Jul 2007
Old 07-14-2007 , 16:25   Re: My script crashes our server
Reply With Quote #10

Excellent, have downloaded that. Our server's filled up for the evening so i'll do the install first thing tomorrow morning and post if we have a crash - i'll PM you a link to the zipped mdmp

Many thanks for this!!
Jernau is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode