Menu

#5001 FD_SET macros must be used

obsolete: 8.4.19
closed-fixed
8
2012-03-05
2012-02-10
No

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).

Discussion

  • Alexandre Ferrieux

    SelectBomb1 : the server

     
  • Alexandre Ferrieux

    SelectBomb2: the FAILING proxy

     
  • Alexandre Ferrieux

    SelectBomb3: the client. Not failing below 16.

     
  • Alexandre Ferrieux

    Closing since it was fixed nearly 3 yrs ago.

     
  • Alexandre Ferrieux

    • status: open --> closed-fixed
     
  • Alexandre Ferrieux

    • status: closed-fixed --> open-out-of-date
     
  • Alexandre Ferrieux

    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 !!!

     
  • Alexandre Ferrieux

    • priority: 5 --> 8
    • status: open-out-of-date --> open
     
  • Alexandre Ferrieux

    In case a 8.4.20 is rolled out...

     
  • Alexandre Ferrieux

    Daniel, any objection against a backport of this specific cleanup to 8.4 ?

     
  • Daniel A. Steffen

    none at all, please feel free!

     
  • Daniel A. Steffen

    • assigned_to: das --> ferrieux
     
  • Alexandre Ferrieux

    Committed to tip of core-8-4-branch

     
  • Alexandre Ferrieux

    • status: open --> closed-fixed