Raised This Month: $51 Target: $400
 12% 

Server Crontab (timer/handle issues)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MoggieX
Veteran Member
Join Date: Aug 2007
Location: n00bville
Old 01-29-2008 , 07:38   Server Crontab (timer/handle issues)
Reply With Quote #1

Howdy,

More a plee to a more experinced coder really, the server crontab plugin at http://forums.alliedmods.net/showthr...t=60046&page=3 fails to compile/run with the latest release of SM, dubbeh appears to ahve been away since last September and I have no idea on how to fix it, as its using timers which:

1. I have no idea on
2. I have no idea why its in a handle in the first place
3. I still have no idea
4. The handle reported issue is changing names (see errors below), its like its in the wrong format


In sc_module.sp at line 62:
PHP Code:
public OnPluginEnd ()
{
    if (
g_hJobsTimer != INVALID_HANDLE)
    {
        
KillTimer (g_hJobsTimer);
        
CloseHandle (g_hJobsTimer);
        
g_hJobsTimer INVALID_HANDLE;
    }
.... 
Errors reported in the error log:
PHP Code:
L 01/26/2008 03:25:05Info (map "de_dust2") (file "errors_20080126.log")
L 01/26/2008 03:25:05: [SMNative "CloseHandle" reportedHandle 1a30033 is invalid (error 3)
L 01/26/2008 03:25:05: [SMDisplaying call stack trace for plugin "sc_module.smx":
L 01/26/2008 03:25:05: [SM]   [0]  Line 62sc_module.sp::OnPluginEnd()
L 01/26/2008 03:25:06Error log file session closed.
L 01/26/2008 03:28:39SourceMod error session started
L 01
/26/2008 03:28:39Info (map "de_dust2_unlimited") (file "errors_20080126.log")
L 01/26/2008 03:28:39: [SMNative "CloseHandle" reportedHandle 1cd500d4 is invalid (error 3)
L 01/26/2008 03:28:39: [SMDisplaying call stack trace for plugin "sc_module.smx":
L 01/26/2008 03:28:39: [SM]   [0]  Line 62sc_module.sp::OnPluginEnd() 
Anyone fancy taking a look?

Matt
Attached Files
File Type: sp Get Plugin or Get Source (sc_module.sp - 181 views - 10.4 KB)
__________________
MoggieX is offline
Send a message via Skype™ to MoggieX
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-29-2008 , 09:50   Re: Server Crontab (timer/handle issues)
Reply With Quote #2

It pointless to be destorying timer in OnPluginEnd(). The reason why is because all handle are destory when the plugin ends. The plugin only ends when the plugin is unloaded/reloaded during map changes. That whole function is not required
__________________
No private support via Instant Message
GunGame:SM Released

Last edited by teame06; 01-29-2008 at 09:56.
teame06 is offline
Send a message via AIM to teame06
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 01-29-2008 , 11:39   Re: Server Crontab (timer/handle issues)
Reply With Quote #3

Quote:
Originally Posted by teame06 View Post
It pointless to be destorying timer in OnPluginEnd(). The reason why is because all handle are destory when the plugin ends. The plugin only ends when the plugin is unloaded/reloaded during map changes. That whole function is not required
According to ferret, this will only happen if the plugin has changed since it was last loaded. Otherwise all repeating timers will continue over to the next map change.
bl4nk is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 01-29-2008 , 23:50   Re: Server Crontab (timer/handle issues)
Reply With Quote #4

Quote:
Originally Posted by bl4nk View Post
According to ferret, this will only happen if the plugin has changed since it was last loaded. Otherwise all repeating timers will continue over to the next map change.
Where as this plugin does it correctly. He does not overlap or keep adding on timers. This plugin only create one timer during OnPluginStart. Which is only called once. As this plugin is calling KillTimer and CloseHandle on the g_hJobsTimer. Which make the handle invalid when KillTimer is ran but g_hJobsTimer still has a handle number because it hasn't been cleared out of the variable g_hJobsTimer.

And I wasn't talking about the timer carrying over to the next map. I was talking about the unnecessary need to Kill the timer in OnPluginEnd. The core will do that for you when the plugin is unloaded.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
MoggieX
Veteran Member
Join Date: Aug 2007
Location: n00bville
Old 01-30-2008 , 03:38   Re: Server Crontab (timer/handle issues)
Reply With Quote #5

OoO, so if I commend out the killtimer function (as it'll do it anyway), prob resolved?!

Quote:
public OnPluginEnd ()
{
if (g_hJobsTimer != INVALID_HANDLE)
{
// KillTimer (g_hJobsTimer);
CloseHandle (g_hJobsTimer);
g_hJobsTimer = INVALID_HANDLE;
}
Appears to compile ok now, will check on our servers.

Thanks,

Matt
__________________
MoggieX is offline
Send a message via Skype™ to MoggieX
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 02:52.


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