Ticket #3260 (closed defect: Fixed)

Opened 6 months ago

Last modified 7 weeks ago

Need to call communicate() on subprocess objects before calling wait

Reported by: jstevens Owned by: jstevens
Priority: 3 - Medium Milestone: zenoss-2.3
Component: All Version: 2.2.0
Keywords: zenoss-2.2.1-verified Cc:
Community Patch Attached: Deployed @ Customer:
Installer: Maintenance Target:
Specific ZenPack: Maintenance Status:
Documentation Note?: Not required Regression:

Description

zenpack --install was hanging on me when installing certain zenpacks. The code in ZenPackCmd.py was calling p.wait() right after p = subprocess.Popen(...., stdout=subprocess.PIPE,...) The problem is that the output buffer was filling up and the process was hung waiting for the buffer to be read while ZenPackCmd was waiting for the process to finish. A little googling led to this discussion:
http://bugs.python.org/issue1606
Basically we need a p.communicate() call prior to the p.wait() call. This is essential when using stdout/stdin=subprocess.PIPE when any lengthy output could occur. We should probably get in the habit of doing this everywhere we use p.wait() however.

Change History

Changed 6 months ago by jstevens

  • status changed from new to closed
  • resolution set to fixed

(In [9370]) fixes #3260

Changed 6 months ago by jstevens

  • keywords zenoss-2.2.1-approved added; zenoss-2.2.1-proposed removed

Reviewed by ecn

Changed 6 months ago by ian

(In [9420]) * Refs #3260: Backported r9370 into the zenoss-2.2.x branch

Changed 6 months ago by ian

  • keywords zenoss-2.2.1-patched added; zenoss-2.2.1-approved removed

Changed 5 months ago by ecn

  • keywords zenoss-2.2.1-verified added; zenoss-2.2.1-patched removed

cent5 32-bit native rpm build 24

Changed 7 weeks ago by bbibeault

  • reviewed set to 1
Note: See TracTickets for help on using tickets.