Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2014-07-10
19:19 • Ticket [ef34dd2457] fileevent writable starves bgerror status still Closed w... artifact: 6c8d59475f user: anonymous
2014-07-06
23:26 • Ticket [ef34dd2457]: 5 changes artifact: 791a013856 user: ferrieux
20:42 • Closed ticket [ef34dd2457]. artifact: f80db57b1a user: anonymous
2013-11-15
12:58 • Ticket [ef34dd2457]: 3 changes artifact: a2a084e371 user: dgp
2013-11-14
20:58 • Ticket [ef34dd2457]: 3 changes artifact: 595ee94dbc user: pooryorick
15:41 • New ticket [ef34dd2457]. artifact: 94619b51a8 user: pooryorick

fileevent writable starves bgerror

Closed / Rejectedef34dd2457472b08cf6a42a7c8c26329e2cae715Created 13 years agoUpdated 12 years ago
Descriptionplain2013-11-14 15:41:51
In the code below, both the readable and writable event scripts are executed, but bgerror never runs because the queue is dominated by the fileevent events.

----

#! /bin/env tclsh

proc handler {arg} {
    return -code error "an error!"
}

lassign [chan pipe] pipeout pipein
set stdout [open |[list echo hello]]
fileevent $pipein writable {apply {{} {}}}
fileevent $stdout readable [list handler $stdout]

vwait exit
pooryorick Ticket [ef34dd2457]: 3 changes [History diff]2013-11-14 20:58:19
dgp Ticket [ef34dd2457]: 3 changes [History diff]2013-11-15 12:58:09
anonymousplain2014-07-06 20:42:21
Not a bug, works just like it should.

from the manpage of bgerror(n):
"When Tcl detects a background error, it  saves  information  about  the error  and invokes a handler command registered by interp bgerror later as an 
idle event handler."
^^^^^^^^^^^^^^^^^^^

...and Tcl_DoOneEvent(3) states that idle callbacks are processed only once there are no other events to process.

In the example, the event loop never gets a chance to do idle callbacks (and bgerror _is_ an idle callback) because there's always a [fileevent readable] event.
ferrieuxplain2014-07-06 23:26:37
Right, but ... any hope to put a name behind "anonymous" ?
anonymousplain2014-07-10 19:19:17
"anonymous" is Simon Bachmann...
I tried to register but I keep getting "Connection was reset" errors...
Log in (anonymous is fine) to add a comment.