Fwd: CPAN Upload: JPRIT/Event-0.66.tar.gz
[email protected] (Joshua N Pritikin)
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
Wow, what a nightmare! This bug affects 0.61-0.65! ----- Forwarded message from [email protected] ----- Date: Tue, 8 Feb 2000 23:00:29 +0100 Subject: CPAN Upload: JPRIT/Event-0.66.tar.gz Sender: [email protected] From: [email protected] To: [email protected], [email protected] The uploaded file Event-0.66.tar.gz has entered CPAN as file: $CPAN/authors/id/JPRIT/Event-0.66.tar.gz size: 65126 bytes md5: c2e690c473191b321e99cd399f2f6ee7 No action is required on your part Request entered by: JPRIT (Joshua N. Pritikin) Request entered on: Tue, 08 Feb 2000 21:59:34 GMT Request completed: Tue, 08 Feb 2000 22:00:29 GMT Virtually Yours, Id: paused,v 1.68 1999/10/22 14:39:12 k Exp k ----- End forwarded message ----- # This is a patch for Event-0.65 to update it to Event-0.66 # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/ChangeLog' '/usr/tmp/mp15127.d/new/Event-0.66/ChangeLog' Index: ./ChangeLog --- ./ChangeLog Mon Feb 7 16:21:58 2000 +++ ./ChangeLog Tue Feb 8 16:53:18 2000 @@ -1,3 +1,14 @@ +2000-02-08 Joshua Pritikin <[email protected]> + + * Release 0.66. + + * Fix horrendously subtle bug uncovered by Event-tcp. + + * Eliminate (hopefully all) silent failures. + + * Restrict var watchers to + scalars. ([email protected] is too creative) + 2000-02-07 Joshua Pritikin <[email protected]> * Release 0.65. gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/c/ev.c' '/usr/tmp/mp15127.d/new/Event-0.66/c/ev.c' Index: ./c/ev.c --- ./c/ev.c Mon Feb 7 13:26:55 2000 +++ ./c/ev.c Tue Feb 8 15:46:37 2000 @@ -148,8 +148,13 @@ static void pe_event_postCB(pe_cbframe * pe_event *ev = fp->ev; pe_watcher *wa = ev->up; --CurCBFrame; - if (WaACTIVE(wa) && WaINVOKE1(wa) && WaREPEAT(wa)) - pe_watcher_on(wa, 1); + if (WaACTIVE(wa) && WaINVOKE1(wa) && WaREPEAT(wa)) { + char *excuse = pe_watcher_on(wa, 1); + if (SvIV(DebugLevel) && excuse) { + STRLEN n_a; + warn("Event: can't restart '%s' %s", SvPV(wa->desc,n_a), excuse); + } + } if (Estat.on) { if (fp->stats) { Estat.scrub(fp->stats, wa); gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/c/io.c' '/usr/tmp/mp15127.d/new/Event-0.66/c/io.c' Index: ./c/io.c --- ./c/io.c Mon Feb 7 10:17:15 2000 +++ ./c/io.c Tue Feb 8 16:51:21 2000 @@ -45,15 +45,17 @@ static char *pe_io_start(pe_watcher *_ev if (ev->fd >= 0) { if (!ev->base.callback) - return "Without io callback"; + return "without io callback"; PE_RING_UNSHIFT(&ev->ioring, &IOWatch); ++IOWatchCount; IOWatch_OK = 0; ++ok; } if (ev->timeout) { - if (!ev->base.callback && !ev->tm_callback) + if (!ev->base.callback && !ev->tm_callback) { + assert(!ok); return "without timeout callback"; + } WaCBTIME_on(ev); ev->poll |= PE_T; ev->tm.at = NVtime() + ev->timeout; /* too early okay */ @@ -110,9 +112,15 @@ static void pe_io_alarm(pe_watcher *_wa, } static void _io_restart(pe_watcher *ev) { + char *excuse; if (!WaPOLLING(ev)) return; pe_watcher_off(ev); - pe_watcher_on(ev, 0); /* ignore failure */ + excuse = pe_watcher_on(ev, 0); + if (SvIV(DebugLevel) && excuse) { + STRLEN n_a; + warn("Event: can't restart '%s' %s", + SvPV(ev->desc, n_a), excuse); + } } static void pe_io_reset_handle(pe_watcher *ev) { /* used by unix_io */ gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/c/signal.c' '/usr/tmp/mp15127.d/new/Event-0.66/c/signal.c' Index: ./c/signal.c --- ./c/signal.c Mon Feb 7 10:17:55 2000 +++ ./c/signal.c Tue Feb 8 15:47:49 2000 @@ -83,9 +83,17 @@ WKEYMETH(_signal_signal) { croak("Unrecognized signal '%s'", SvPV(nval, n_a)); if (!PE_SIGVALID(sig)) croak("Signal '%s' cannot be caught", SvPV(nval, n_a)); + /* factor XXX */ if (active) pe_watcher_off(ev); sg->signal = sig; - if (active) pe_watcher_on(ev, 0); + if (active) { + char *excuse = pe_watcher_on(ev, 0); + if (SvIV(DebugLevel) && excuse) { + STRLEN n_a; + warn("Event: can't restart '%s' %s", + SvPV(ev->desc, n_a), excuse); + } + } } } gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/c/timer.c' '/usr/tmp/mp15127.d/new/Event-0.66/c/timer.c' Index: ./c/timer.c --- ./c/timer.c Mon Feb 7 13:24:54 2000 +++ ./c/timer.c Tue Feb 8 15:46:55 2000 @@ -57,10 +57,18 @@ WKEYMETH(_timer_at) { XPUSHs(sv_2mortal(newSVnv(tp->tm.at))); PUTBACK; } else { + /* factor XXX */ int active = WaPOLLING(ev); if (active) pe_watcher_off(ev); tp->tm.at = SvNV(nval); - if (active) pe_watcher_on(ev, 0); + if (active) { + char *excuse = pe_watcher_on(ev, 0); + if (SvIV(DebugLevel) && excuse) { + STRLEN n_a; + warn("Event: can't restart '%s' %s", + SvPV(ev->desc,n_a), excuse); + } + } } } gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/c/unix_io.c' '/usr/tmp/mp15127.d/new/Event-0.66/c/unix_io.c' Index: ./c/unix_io.c --- ./c/unix_io.c Wed Jan 19 10:40:29 2000 +++ ./c/unix_io.c Tue Feb 8 16:51:45 2000 @@ -87,12 +87,12 @@ static void pe_sys_multiplex(double time while (ev) { int fd = ev->fd; ev->xref = -1; - if (fd >= 0) { + assert(fd >= 0); { int bits=0; if (ev->poll & PE_R) bits |= (POLLIN | POLLRDNORM | POLLHUP); if (ev->poll & PE_W) bits |= (POLLOUT |POLLWRNORM |POLLWRBAND); if (ev->poll & PE_E) bits |= (POLLRDBAND | POLLPRI); - if (bits) { + assert(bits); { int ok=0;; for (xx = 0; xx < Nfds; xx++) { if (Pollfd[xx].fd == fd) { ok=1; break; } gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/c/var.c' '/usr/tmp/mp15127.d/new/Event-0.66/c/var.c' Index: ./c/var.c --- ./c/var.c Mon Feb 7 10:18:42 2000 +++ ./c/var.c Tue Feb 8 15:48:10 2000 @@ -127,9 +127,14 @@ static void pe_var_stop(pe_watcher *_ev) } static void _var_restart(pe_watcher *ev) { + char *excuse; if (!WaPOLLING(ev)) return; pe_watcher_off(ev); - pe_watcher_on(ev, 0); + excuse = pe_watcher_on(ev, 0); + if (SvIV(DebugLevel) && excuse) { + STRLEN n_a; + warn("Event: can't restart '%s' %s", SvPV(ev->desc, n_a), excuse); + } } WKEYMETH(_var_events) { @@ -155,9 +160,19 @@ WKEYMETH(_var_variable) { int active = WaPOLLING(ev); if (!SvROK(nval)) croak("Expecting a reference"); + if (SvTYPE(SvRV(nval)) > SVt_PVMG) + croak("Var watchers can only watch plain vanilla scalars"); + /* factor XXX */ if (active) pe_watcher_off(ev); vp->variable = SvREFCNT_inc(nval); - if (active) pe_watcher_on(ev, 0); + if (active) { + char *excuse = pe_watcher_on(ev, 0); + if (SvIV(DebugLevel) && excuse) { + STRLEN n_a; + warn("Event: can't restart '%s' %s", + SvPV(ev->desc,n_a), excuse); + } + } SvREFCNT_dec(old); } } gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/c/watcher.c' '/usr/tmp/mp15127.d/new/Event-0.66/c/watcher.c' Index: ./c/watcher.c --- ./c/watcher.c Mon Feb 7 13:26:35 2000 +++ ./c/watcher.c Tue Feb 8 16:46:59 2000 @@ -310,8 +310,11 @@ static void pe_watcher_resume(pe_watcher if (WaDEBUGx(ev) >= 4) warn("Event: resume '%s'%s%s\n", SvPV(ev->desc,n_a), WaACTIVE(ev)?" ACTIVE":""); - if (WaACTIVE(ev)) - pe_watcher_on(ev, 0); /* ignore failure */ + if (WaACTIVE(ev)) { + char *excuse = pe_watcher_on(ev, 0); + if (excuse) + warn("Event: can't resume '%s' %s", SvPV(ev->desc,n_a), excuse); + } } static char *pe_watcher_on(pe_watcher *wa, int repeat) { @@ -323,7 +326,9 @@ static char *pe_watcher_on(pe_watcher *w SvPV(wa->desc,n_a)); } excuse = (*wa->vtbl->start)(wa, repeat); - if (!excuse) + if (excuse) + pe_watcher_stop(wa, 1); /* update flags! */ + else WaPOLLING_on(wa); /* must happen nowhere else!! */ return excuse; } gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/lib/Event.pm' '/usr/tmp/mp15127.d/new/Event-0.66/lib/Event.pm' Index: ./lib/Event.pm --- ./lib/Event.pm Mon Feb 7 16:22:05 2000 +++ ./lib/Event.pm Tue Feb 8 16:53:36 2000 @@ -13,7 +13,7 @@ use Carp; eval { require Carp::Heavy; }; # work around perl_call_pv bug XXX use vars qw($VERSION @EXPORT_OK $API $DebugLevel $Eval $DIED $Now); -$VERSION = '0.65'; +$VERSION = '0.66'; # If we inherit DynaLoader then we inherit AutoLoader; Bletch! require DynaLoader; gdiff -up '/usr/tmp/mp15127.d/old/Event-0.65/lib/Event.pod' '/usr/tmp/mp15127.d/new/Event-0.66/lib/Event.pod' Index: ./lib/Event.pod --- ./lib/Event.pod Mon Feb 7 13:08:50 2000 +++ ./lib/Event.pod Tue Feb 8 11:42:40 2000 @@ -74,7 +74,10 @@ Watchers are returned in order of most r =item all_idle() -Return all watchers on the idle queue. +If the event queue is very busy, all the idle watchers will sit on the +idle queue waiting to run. However, be aware that if an idle watcher +has the C<max> attribute set then it will queue a normal event when +its C<max> wait time is exceeded. =back @@ -214,7 +217,9 @@ Otherwise, they might be deprecated. Extra attributes: var => \$var, poll => 'rw' Var watchers generate events when the given variable is read from or -written to. +written to. As perl is a concise language, it is often difficult to +predict when a variable will be read. For this reason, variable +watchers should poll for writes unless you know what you are doing. =item timer #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Tue Feb 8 16:58:46 2000 # Generated by : makepatch 2.00 (2.0BETA) # Recurse directories : Yes # p 'ChangeLog' 22088 950046798 0100444 # p 'c/ev.c' 7857 950042797 0100444 # p 'c/io.c' 5367 950046681 0100444 # p 'c/signal.c' 3845 950042869 0100444 # p 'c/timer.c' 2173 950042815 0100444 # p 'c/unix_io.c' 6439 950046705 0100444 # p 'c/var.c' 4139 950042890 0100444 # p 'c/watcher.c' 8948 950046419 0100444 # p 'lib/Event.pm' 4254 950046816 0100444 # p 'lib/Event.pod' 21914 950028160 0100444 #### End of ApplyPatch data #### #### End of Patch kit [created: Tue Feb 8 16:58:46 2000] #### #### Checksum: 294 9736 6843 #### -- "May the best description of competition prevail." via, but not speaking for Deutsche Bank