Bug 128845 - devel/scons has race condition
Summary: devel/scons has race condition
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Philip M. Gollucci
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-13 16:40 UTC by Steven Kreuzer
Modified: 2008-12-25 15:00 UTC (History)
0 users

See Also:


Attachments
file.diff (2.75 KB, patch)
2008-11-13 16:40 UTC, Steven Kreuzer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Kreuzer 2008-11-13 16:40:05 UTC
Python's subprocess module has a race condition: Popen() constructor has a call to global "_cleanup()" function on whenever a Popen object gets created, and that call causes a check for all pending Popen objects whether their subprocess has exited - i.e. the poll() method is called for every active Popen object.

See http://bugs.python.org/issue1731717 for addition details

SCon's compat/_scons_subprocess.py module is just a copy of a more recent
stock Python subprocess.py modified so it will work with older Python
versions.

The attached patch will add locks around calls to Popen and change
the compat module in a way that the subprocess module is always used, no matter if Python already ships one.

The rationale behind this decision is that there are many Python versions in the wild with different Popen() race condition problems.

Fix: Patch attached with submission follows:
How-To-Repeat: Run scons -j8 on a quad core machine
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-11-13 16:40:16 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pgollucci

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Philip M. Gollucci freebsd_committer freebsd_triage 2008-12-25 14:57:22 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 3 dfilter service freebsd_committer freebsd_triage 2008-12-25 14:57:22 UTC
pgollucci    2008-12-25 14:57:06 UTC

  FreeBSD ports repository

  Modified files:
    devel/scons          Makefile 
  Added files:
    devel/scons/files    patch-engine-SCons-compat-__init__.py 
                         patch-engine-SCons-compat-_scons_subprocess.py 
  Log:
  Python's subprocess module has a race condition: Popen() constructor has a call to global "_cleanup()" function on whenever a Popen object gets created, and that call causes a check for all pending Popen objects whether their subprocess has exited - i.e. the poll() method is called for every active Popen object.
  
  See http://bugs.python.org/issue1731717 for addition details
  
  SCon's compat/_scons_subprocess.py module is just a copy of a more recent
  stock Python subprocess.py modified so it will work with older Python
  versions.
  
  The attached patch will add locks around calls to Popen and change
  the compat module in a way that the subprocess module is always used, no matter if Python already ships one.
  
  The rationale behind this decision is that there are many Python versions in the wild with different Popen() race condition problems.
  
  PR:             ports/128845
  Submitted by:   Steven Kreuzer <skreuzer@exit2shell.com>
  Approved by:  araujo (mentor, implicit)
  
  Revision  Changes    Path
  1.35      +1 -0      ports/devel/scons/Makefile
  1.1       +29 -0     ports/devel/scons/files/patch-engine-SCons-compat-__init__.py (new)
  1.1       +33 -0     ports/devel/scons/files/patch-engine-SCons-compat-_scons_subprocess.py (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"