maintainer-feedback requested: [Bug 221700] lang/python: subprocess does not use closefrom, calls close(2) hundreds of thousands of times

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Aug 21 19:54:10 UTC 2017


Ed Maste <emaste at freebsd.org> has reassigned Bugzilla Automation
<bugzilla at FreeBSD.org>'s request for maintainer-feedback to FreeBSD Python
<python at FreeBSD.org>:
Bug 221700: lang/python: subprocess does not use closefrom, calls close(2)
hundreds of thousands of times
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221700



--- Description ---
% python --version
Python 2.7.13
% pkg info python | grep Version
Version        : 2.7_3,2


% ktrace -i python -c 'import subprocess; subprocess.call("/usr/bin/true",
close_fds=True);'
% kdump -s | egrep -c 'CALL.*close'
939647

excerpt from kdump:
  1958 python2.7 CALL  close(0x3)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0x5)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0x6)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0x7)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0x8)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0x9)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
...
  1958 python2.7 CALL  close(0xe5628)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0xe5629)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0xe562a)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor
  1958 python2.7 CALL  close(0xe562b)
  1958 python2.7 RET   close -1 errno 9 Bad file descriptor

This has both a performance impact and an impact on the ability to debug
problems with python programs.


More information about the freebsd-python mailing list