egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Detect "(!) timer drift -- spun"

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
SaPrOuZy
Halfop


Joined: 24 Mar 2004
Posts: 75
Location: Lebanon

PostPosted: Sat Apr 21, 2007 7:29 am    Post subject: Detect "(!) timer drift -- spun" Reply with quote

Hey all,
is there a way to detect "(!) timer drift -- spun X minutes" i have a join flood protection script that i want to disable when this happens because it will mistake normal joins with floods. i have a lag check incorporated in the script, it works fine when the bot is lagging due to connection problem but when the eggdrop process by it self is having problems (CPU time or whatever) my lag check fails since it can't run.

now if there is a bind or something to detect "(!) timer drift -- spun X minutes" then it would be more effective than having a lag check every x minutes.

thanks in advance.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Apr 21, 2007 9:05 am    Post subject: Reply with quote

The only thing that will trigger after 'timer drift' is the HOOK_MINUTELY (once for each minute "missed"). This in its turn will trigger a check for time-bindings, so I guess this might be a way of writing a detector of some sort (checking if a time-binding triggers several times within a very short timespan).

There is, however, no direct hook or trigger for timer drift, so you'll be forced to write your own detector.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Apr 21, 2007 10:14 pm    Post subject: Reply with quote

Weird Messages That Get Logged:
Quote:
(!) timer drift -- spun N minutes

This can be caused by one of several reasons.

- Your bot could have been swapped out of memory for a while, or for
some reason the computer could have stopped letting the bot run. Once
a minute, Eggdrop does a few maintenance things, including counting
down any active Tcl timers. If for some reason, several minutes pass
without Eggdrop being able to do this, it logs this message to let
you know what happened. It's generally a bad thing, because it means
that the system your bot is on is very busy, and the bot can hardly
keep track of the channel very well when it gets swapped out for
minutes at a time.

- On some systems (at least Linux), if the DNS your bot is using to
lookup hostnames is broken and *very* slow in responding (this can
occur if the DNS server's uplink doesn't exist), then you will get
4-5 minute timer drifts continuously. This can be fixed by loading
the dns module.

- The clock on your machine has just been changed. It may have been
running behind by several minutes and was just corrected.

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Sun Apr 22, 2007 8:22 am    Post subject: Reply with quote

Something like this might work (not tested):
Code:
bind time - * {set lastminute [clock sec];#}

proc yourjoinfloodprotectionscript {} {
   if {$::lastminute<([clock sec]-60)} {
      # timer drift...don't kick?
   } {
      # work as normal
   }
}

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Apr 22, 2007 8:35 am    Post subject: Reply with quote

I'm afraid that will not work, as the timestamp used to trigger the time-binding is "current" even in the timer-drift condition.
The effect however, would be that the time-binding will trigger multiple times with the same minute-value.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Apr 22, 2007 11:27 am    Post subject: Reply with quote

Code:
bind time - * checkdrift
set _lastmin 0

proc checkdrift {args} {
 global _lastmin timerdrift
 if {${_lastmin} == [lindex $args 0]} {
  set timerdrift 1
 } {
  set timerdrift 0
  set _lastmin [lindex $args 0]
 }
}


I believe this code would set the globalspace variable timerdrift to 1 when a timerdrift conditon occurs, and resets it to 0 upon next "proper" HOOK_MINUTELY hook. However, this code has not been tested either.

Worth noting, one of the most common causes for timerdrifts are tcl-scripts that do some heavy data manipulation (or invokes an external application to do it, such as pisg), or ftp-scripts. This is due to the fact that eggdrop only uses one tcl-interpreter and no further threads; and will only execute one (tcl) command at any single time.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Apr 22, 2007 4:55 pm    Post subject: Reply with quote

Good to know. I get them quite a bit from my old p2 lagging.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber