From owner-freebsd-python@freebsd.org Tue Aug 22 15:08:13 2017 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7EFBDF0ED6 for ; Tue, 22 Aug 2017 15:08:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 8B88565382 for ; Tue, 22 Aug 2017 15:08:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 8ACC9DF0ED5; Tue, 22 Aug 2017 15:08:13 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A629DF0ED4 for ; Tue, 22 Aug 2017 15:08:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7843765381 for ; Tue, 22 Aug 2017 15:08:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id v7MF8Deu054078 for ; Tue, 22 Aug 2017 15:08:13 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: python@FreeBSD.org Subject: [Bug 221700] lang/python: subprocess does not use closefrom, calls close(2) hundreds of thousands of times Date: Tue, 22 Aug 2017 15:08:13 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: cem@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: python@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2017 15:08:13 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D221700 Conrad Meyer changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |cem@freebsd.org --- Comment #3 from Conrad Meyer --- You might also consider closefrom() in posix_closerange() of Modules/posixmodule.c: --- ./Modules/posixmodule.c 2015-05-23 09:09:20.000000000 -0700 +++ ./Modules/posixmodule.c 2015-07-17 15:00:38.784909475 -0700 @@ -6668,9 +6668,12 @@ if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to)) return NULL; Py_BEGIN_ALLOW_THREADS - for (i =3D fd_from; i < fd_to; i++) - if (_PyVerify_fd(i)) - close(i); + if (fd_to >=3D sysconf(_SC_OPEN_MAX)) { + closefrom(fd_from); + } else + for (i =3D fd_from; i < fd_to; i++) + if (_PyVerify_fd(i)) + close(i); Py_END_ALLOW_THREADS Py_RETURN_NONE; } --=20 You are receiving this mail because: You are the assignee for the bug.=