This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Socket -server | Lag when using Eggdrop

Old posts that have not been replied to for several years.
Locked
M
Merwin
Voice
Posts: 7
Joined: Fri Jun 10, 2005 4:24 am

Socket -server | Lag when using Eggdrop

Post by Merwin »

Hi,

I dn't know why but when i use socket -server on Eggdrop it lags a lot.
However, the same code with wish or tclsh doesn't lag...

I don't understand, if somebody have a idea?
.:: Merwin ::.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

paste the code
M
Merwin
Voice
Posts: 7
Joined: Fri Jun 10, 2005 4:24 am

mkHttpd

Post by Merwin »

I use de very good lib mkHttpd (http://mkextensions.sf.net), in a tclsh prohram this lib works very weel but inside Eggdrop it lag !
.:: Merwin ::.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

that site is down

I'd however speculate that the problem is with using [vwait] - inside wish/tclsh you don't have to bother about giving a chance to eggdrop handlers to process IRC events - and inside eggdrop you naturally must do that, otherwise the bot will hang and ping timeout

so if you want a TCP (probably HTTP) server to run on eggdrop, you better use eggdrop's [listen] and [control] procs
M
Merwin
Voice
Posts: 7
Joined: Fri Jun 10, 2005 4:24 am

Right

Post by Merwin »

I've think the same about vwait, so i've look the code, but the library dosen't contain any vwait command becouse the httpd server must be used in an application, for example using Tk, so it doesn't need vwait !

I don't like the listen/control procs becouse you can't scecify ip or configure the socket (blocking, buffer, etc...)
.:: Merwin ::.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

I can't believe there's no [vwait] in that code - you must somehow enter TCL's event loop to be able to process incoming connections - and the only way to do that from a script is to use [vwait]; in a C app, you'd use Tcl_DoOneEvent() - like eggdrop does in its event loop

and there's no need to configure the socket when using eggdrop's listen/control procs - all I/O in eggdrop is asynchronous (non-blocking) and buffered
M
Merwin
Voice
Posts: 7
Joined: Fri Jun 10, 2005 4:24 am

Yes

Post by Merwin »

This is a library ! Consequently the event loop has to be managed by the application that use it!

It is logic ! I've look the code to find a vwait command et there is no! I'm sure about that!

http://mkextensions.sourceforge.net/mkHttpd10.zip
.:: Merwin ::.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Re: Yes

Post by demond »

Merwin wrote:This is a library ! Consequently the event loop has to be managed by the application that use it!
then manage it - use [vwait] from your eggdrop script that utilizes mkHttpd package
M
Merwin
Voice
Posts: 7
Joined: Fri Jun 10, 2005 4:24 am

Test

Post by Merwin »

Hi,

I've test two things:

1) use the script directly under Eggdrop (http://shell2.akseo.net:8888 to see the result with lag)
2) use the exec command to invoke tclsh on a script that starts the httpd (with teh same package) and there is no lag !

I think Eggdrop should force the use of certain values with fconfigure as -bufferring none !
.:: Merwin ::.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you are mistaken, and you obviously have misunderstood all of the above

eggdrop has nothing to do with [fconfigure], eggdrop is not a Tcl script
M
Merwin
Voice
Posts: 7
Joined: Fri Jun 10, 2005 4:24 am

error

Post by Merwin »

you don't understand what i'm explaining becouse i'm bad in english, i'm not a newbie and i know very well what Eggdrop is and what a tcl script is.

I tell you that when i use mkHttpd not with Eggdrop, but whith tclsh directly there is no lag whereas when a use mkHttpd in an Eggdrop script there is a lag !
.:: Merwin ::.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

while your English is somewhat poor, I still know what you are saying

and I don't believe it is so poor you can't understand what I'm saying; you just don't understand [vwait] and Tcl's event loop
M
Merwin
Voice
Posts: 7
Joined: Fri Jun 10, 2005 4:24 am

...

Post by Merwin »

But i know very well what is vwait !

For example when i create a socket i do a fileevent on the sockid to call a proc when it is readable, but i must use vwait to enter Tcl Event loop !
If i don't the script will terminate, in the case of a socket i use a variable name that is never fixed to loop forever.

When i use Tcl in Eggdrop, i don't need vwait becouse Eggdrop have his proper event loop !
.:: Merwin ::.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

dude, eggdrop has many other things to do besides (occasionally) invoking Tcl_DoOneEvent() - whereas [vwait] in your tclsh script doesn't do anything else but looping/waiting on Tcl_DoOneEvent() (see Tcl sources if you know C)

so, if your eggdrop is busy serving what it was meant to serve - IRC channels - it would naturally be slower in serving HTTP requests via your extension - slower than your dedicated tclsh script which doesn't do anything else
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

example: I have a port checking script which waits for 2 fileevents (first: writeable and then readable). even it just opens a port , sends "\n" and closes it again (which needs about 150ms in blocking mode) it takes about 1500-2000ms, because fileevent triggers very slow. So probably the socket trigger isnt triggered much faster ;). Personally I always had the feeling that eggdrop waits a bit longer as necessary, probably it isn't running the main loop as fast as the cpu would allow, because it would increase the cpu usage too high ^-^.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked