From mboxrd@z Thu Jan  1 00:00:00 1970
From: Nam Nguyen <namn@berkeley.edu>
Subject: bug#33213: python-3/fixed and python-minimal test_socket.py
Date: Tue, 30 Oct 2018 22:24:21 -0700
Message-ID: <20181031052336.GA9940@antelope>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Return-path: <bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org>
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50162)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1gHj06-0004FY-NM
	for bug-guix@gnu.org; Wed, 31 Oct 2018 01:25:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1gHj02-00048o-OU
	for bug-guix@gnu.org; Wed, 31 Oct 2018 01:25:06 -0400
Received: from debbugs.gnu.org ([208.118.235.43]:51887)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1gHj02-00048d-Ie
	for bug-guix@gnu.org; Wed, 31 Oct 2018 01:25:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1gHj02-0005Yt-AV
	for bug-guix@gnu.org; Wed, 31 Oct 2018 01:25:02 -0400
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-Message-ID: <handler.33213.B.154096349421360@debbugs.gnu.org>
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50108)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <namluunguyen@gmail.com>) id 1gHizl-0004F9-O4
	for bug-guix@gnu.org; Wed, 31 Oct 2018 01:24:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <namluunguyen@gmail.com>) id 1gHizh-0003y7-Pn
	for bug-guix@gnu.org; Wed, 31 Oct 2018 01:24:45 -0400
Received: from mail-ed1-f51.google.com ([209.85.208.51]:45773)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <namluunguyen@gmail.com>)
	id 1gHizh-0003xV-IJ
	for bug-guix@gnu.org; Wed, 31 Oct 2018 01:24:41 -0400
Received: by mail-ed1-f51.google.com with SMTP id t10-v6so12510129eds.12
	for <bug-guix@gnu.org>; Tue, 30 Oct 2018 22:24:41 -0700 (PDT)
Content-Disposition: inline
List-Id: Bug reports for GNU Guix <bug-guix.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-guix>,
	<mailto:bug-guix-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-guix/>
List-Post: <mailto:bug-guix@gnu.org>
List-Help: <mailto:bug-guix-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-guix>,
	<mailto:bug-guix-request@gnu.org?subject=subscribe>
Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org
Sender: "bug-Guix" <bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org>
To: 33213@debbugs.gnu.org

Hi,

python has a memory leak in the test for test_socket.py, and it was
fixed in commit 90aeaee861845142843a0f988fa4ff016c723cdb.

https://git.savannah.gnu.org/cgit/guix.git/commit/?id=90aeaee861845142843a0f988fa4ff016c723cdb

More information from IRC:
----8<------------------------------------------------------------
<mbakke> There is a bug in Python 3 which causes the test suite to run
    out of memory on recent kernels:
    https://bugs.python.org/issue34587
<mbakke> Unfortunately the only workaround I can think of is removing
    "/tmp/guix-build-python-3.6.5.drv-0/Lib/test/test_socket.py" some
    time during the build (but before the check phase).
----8<------------------------------------------------------------

However, python-minimal still runs test_socket, causing a memory
leak. Is it possible to change python-minimal so it uses python-3/fixed?
I was able to successfully build python-minimal by appending the fix to
python-minimal, as below. I do not know how (replacement python-3/fixed)
interacts with python-minimal.

----8<------------------------------------------------------------
(define-public python-minimal
  (package/inherit python
    (name "python-minimal")
    (outputs '("out"))

    ;; Build fails due to missing ctypes without libffi.
    ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
    ;; zlib is required by 'zipimport', used by pip.
    (inputs `(("libffi" ,libffi)
              ("openssl" ,openssl)
              ("zlib" ,zlib)))
    (arguments
     (substitute-keyword-arguments (package-arguments python-3)
       ((#:phases phases)
        `(modify-phases ,phases
           (add-after 'unpack 'delete-broken-test
             (lambda _
               ;; Delete test which fails on recent kernels:
               ;; <https://bugs.python.org/issue34587>.
               (delete-file "Lib/test/test_socket.py")
               #t))))))))
----8<------------------------------------------------------------