Tcl Source Code

View Ticket
Login
Ticket UUID: 3486554
Title: FD_SET macros must be used
Type: Bug Version: obsolete: 8.4.19
Submitter: ferrieux Created on: 2012-02-10 14:55:28
Subsystem: 01. Notifier Assigned To: ferrieux
Priority: 8 Severity:
Status: Closed Last Modified: 2012-03-06 00:30:24
Resolution: Fixed Closed By: ferrieux
    Closed on: 2012-03-05 17:30:24
Description:
This report is here to document a past fix, but is nonetheless important as a reference for people encountering the associated bugs in older versions, since these bugs have not been reported here.

Prior to Check-in [e496f9ef50] by Daniel A. Steffen,  2009-04-10 20:46:21,

* unix/tclUnixChan.c: TclUnixWaitForFile(): use FD_* macros * macosx/tclMacOSXNotify.c:to manipulate select masks (Cassoff). Bug 1960647

there were dangerously non-portable shift manipulations in TclUnixWaitForFile(). These have been properly replaced by the clean FD_SET et al. macros by Daniel.

Here is the behavior, observed independently by me on 8.4.13 and by evilotto on 8.4.12, both on x84_64 Linux:

A fileevent readable on a high descriptor (above 32) repeatedly fires, but the [read]s done on it don't consume any bytes, leading to a busyloop known as "select bomb". The failing bitshifts misdirected the setting of the select() bits.

Attached scripts, courtesy of evilotto, expose the behavior.
Also, the problem is likely to occur under load when using [package require httpd] asynchronously (many simultaneous requests must be active).
User Comments: ferrieux added on 2012-03-06 00:30:24:
Committed to tip of core-8-4-branch

das added on 2012-03-05 09:21:07:
none at all, please feel free!

ferrieux added on 2012-03-05 01:53:17:
Daniel, any objection against a backport of this specific cleanup to 8.4 ?

ferrieux added on 2012-03-05 01:49:19:
In case a 8.4.20 is rolled out...

ferrieux added on 2012-02-10 22:02:25:
Reopening since it was never backported to 8.4.
Pending specific action, the 8.4 branch remains crippled in that regard: don't use 8.4 on x86_64 !!!

ferrieux added on 2012-02-10 21:58:12:
Closing since it was fixed nearly 3 yrs ago.

ferrieux added on 2012-02-10 21:57:29:

File Added - 435419: selectbomb3.tcl

ferrieux added on 2012-02-10 21:56:45:

File Added - 435417: selectbomb2.tcl

ferrieux added on 2012-02-10 21:56:18:

File Added - 435415: selectbomb1.tcl

Attachments: