From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id eL5OAq2LfGOGzgAAbAwnHQ (envelope-from ) for ; Tue, 22 Nov 2022 09:43:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id EB1JAq2LfGOCgAAA9RJhRA (envelope-from ) for ; Tue, 22 Nov 2022 09:43:25 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2B57F90E3 for ; Tue, 22 Nov 2022 09:43:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxOs6-0006al-NW; Tue, 22 Nov 2022 03:43:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxOrv-0006a0-2l for bug-guix@gnu.org; Tue, 22 Nov 2022 03:43:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxOru-0006R9-OW for bug-guix@gnu.org; Tue, 22 Nov 2022 03:43:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxOru-0005dJ-C6 for bug-guix@gnu.org; Tue, 22 Nov 2022 03:43:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#59365: make-dynamic-linker-cache OOMs for LLVM 15 on i686-linux Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 22 Nov 2022 08:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59365 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Marius Bakke Cc: 59365@debbugs.gnu.org, Maxim Cournoyer , Greg Hogan Received: via spool by 59365-submit@debbugs.gnu.org id=B59365.166910655421619 (code B ref 59365); Tue, 22 Nov 2022 08:43:02 +0000 Received: (at 59365) by debbugs.gnu.org; 22 Nov 2022 08:42:34 +0000 Received: from localhost ([127.0.0.1]:49691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxOrR-0005cd-MS for submit@debbugs.gnu.org; Tue, 22 Nov 2022 03:42:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxOrP-0005cP-F5 for 59365@debbugs.gnu.org; Tue, 22 Nov 2022 03:42:32 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxOrJ-0006Kg-Rg; Tue, 22 Nov 2022 03:42:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=GRWNBFaH+l9SToWarPpluIlsJ8gyxSbMonB3FaZY5h8=; b=hjqCsnLDZgR3s1+qrH7t kyz6sAzIRev0KHqUPbzwrTf98SyCCp2rnc2s79wpUPmpee8YIA+SaaAMMrVSOaeSa5gBIW8MWCC82 wovN2pqKjrMVjtsc0EeJHEFnTCADXGUMRU3MqHJWHvKLHs+f3Nk9W4nmoXpcN2PAJ3ueRGABcDSyb /T38rKPP8Lz+MUPZpyitUiinQqi5EFVzqEwPHrDFB9GR+mu2F6LETjcx/zXRvEbf30d9U/IZ1wvWL fdo/GmaT0pEzm4SBf7ZMnOchpH8Y+mI6hQkmOhHjpmIoZF8P/DRVPiMjZSZK+SxibexEcI8pclhp2 QmAiev2QPi+KEQ==; Received: from [89.207.171.76] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxOrG-0003PM-Q5; Tue, 22 Nov 2022 03:42:25 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87mt8o14xd.fsf@gnu.org> Date: Tue, 22 Nov 2022 09:42:19 +0100 In-Reply-To: <87mt8o14xd.fsf@gnu.org> (Marius Bakke's message of "Fri, 18 Nov 2022 19:41:18 +0100") Message-ID: <877cznidn8.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669106604; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=GRWNBFaH+l9SToWarPpluIlsJ8gyxSbMonB3FaZY5h8=; b=Z9WMwD5zguE+D8KcUxo76qb8H2QyK6lAe5itDVG5ODre6gUANQ9sMEqq0fipudrzgx3jdB l01x1JvVK6OKSTy5ka5VH7xnTexA4/NOLI+DOy8HGVXKC+JOb0Di+5eGXOHDh1i3iOp5qJ X4QkQt14tBdZ5YpxpzV/i97fgRspTj99u0OZ0MZYmtlC98RCzLZ48X0X2fzpwQ8W4fe3KV rKcbBL9R3cpwIoqLvi6D4tFN8ScZnzdE26hghtRlDHCDACVgqpMikVlCeyRFGkkz6KY0H3 RiUMoU/PYes3TtBPQCqUIcP0PqKEWwJx4w47kq8vdzj2eC1GuHfxDLKqETzIBQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669106604; a=rsa-sha256; cv=none; b=m4U1mQoQ8SIK1JQABUfqQWHHLaIHmx5CV5WYi+C7cs4EYvsuJxaQxXE7gNf3PphGnIyVLr FKGiRQ4H7Y4wDQs1WezKl5sctOhCbB1335/QitTJpR+qqgsf3/A05IayLebPhG1sM/lsZ+ 2XSZnvs6TTdZd/Mq0bLZqyeUvs7yPtv1dsIe71P2UIB1ZExNzV03eI19txZXUnPhuVwhBg iqTFdg93Zxe/hUCyMvJKiDdeKSgg2CSTr44llsNP621cQ0vVAfNig/sWo4Ol2rdbkSUgnT GoPEWbjqTwwTYhSgL/V5CQKCxYp0UhBGUjnlf8ZohF9KFEjfBrXiUc0GvtyQDg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=hjqCsnLD; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.00 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=hjqCsnLD; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 2B57F90E3 X-Spam-Score: -2.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: 8eQOObWkBLiA --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, (Cc: Maxim and Greg for LLVM packaging questions below.) Marius Bakke skribis: > LLVM 15.0.4 fails on i686-linux: > > https://ci.guix.gnu.org/build/1702995/details > > Because the 'make-dynamic-linker-cache' phase runs out of memory: > > starting phase `make-dynamic-linker-cache' > GC Warning: Repeated allocation of very large block (appr. size 2684395= 52): > May lead to memory leak and poor performance > GC Warning: Repeated allocation of very large block (appr. size 1342218= 24): > May lead to memory leak and poor performance > GC Warning: Repeated allocation of very large block (appr. size 2684395= 52): > May lead to memory leak and poor performance > GC Warning: Failed to expand heap by 285216768 bytes > GC Warning: Failed to expand heap by 268439552 bytes > GC Warning: Out of Memory! Heap size: 3620 MiB. Returning NULL! > Warning: Unwind-only out of memory exception; skipping pre-unwind handl= er. > Warning: Unwind-only out of memory exception; skipping pre-unwind handl= er. > Warning: Unwind-only out of memory exception; skipping pre-unwind handl= er. > > (excerpt from https://ci.guix.gnu.org/build/1702995/log/raw) > > Not sure why this phase uses so much memory. Ideas? Yes: the gremlin.scm code uses =E2=80=98file-dynamic-info=E2=80=99, which l= oads the whole file in memory. Ridiculous. We should instead mmap it (but there are no =E2=80=98mmap=E2=80=99 bindings= in Guile, yet) or arrange to load just the relevant parts (we=E2=80=99ll have to chec= k but maybe =E2=80=98file-dynamic-info=E2=80=99 can find everything it needs at t= he beginning of a file, the PT_DYNAMIC segment.) For example, with the patch below, things still appear to be fine with LLVM: --8<---------------cut here---------------start------------->8--- scheme@(guix build gremlin)> (file-dynamic-info "/gnu/store/mj14k58lfc88jhc= n6va0s2fpwkv3s35c-llvm-13.0.1/lib/libLLVMScalarOpts.so") $11 =3D #< soname: "libLLVMScalarOpts.so.13" needed: ("li= bLLVMAggressiveInstCombine.so.13" "libLLVMInstCombine.so.13" "libLLVMTransf= ormUtils.so.13" "libLLVMAnalysis.so.13" "libLLVMCore.so.13" "libLLVMSupport= .so.13" "libstdc++.so.6" "libm.so.6" "libgcc_s.so.1" "libc.so.6" "ld-linux-= x86-64.so.2") rpath: () runpath: ("/gnu/store/mj14k58lfc88jhcn6va0s2fpwkv3s= 35c-llvm-13.0.1/lib" "/gnu/store/5h2w4qi9hk1qzzgi1w83220ydslinr4s-glibc-2.3= 3/lib" "/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib" "/g= nu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3.0-lib/lib/gcc/x86_64-unk= nown-linux-gnu/10.3.0/../../..")> scheme@(guix build gremlin)> (file-dynamic-info "/gnu/store/mj14k58lfc88jhc= n6va0s2fpwkv3s35c-llvm-13.0.1/lib/libLLVMX86CodeGen.so.13") $12 =3D #< soname: "libLLVMX86CodeGen.so.13" needed: ("li= bLLVMAsmPrinter.so.13" "libLLVMX86Desc.so.13" "libLLVMX86Info.so.13" "libLL= VMGlobalISel.so.13" "libLLVMCFGuard.so.13" "libLLVMSelectionDAG.so.13" "lib= LLVMCodeGen.so.13" "libLLVMTarget.so.13" "libLLVMTransformUtils.so.13" "lib= LLVMAnalysis.so.13" "libLLVMProfileData.so.13" "libLLVMMC.so.13" "libLLVMCo= re.so.13" "libLLVMSupport.so.13" "libstdc++.so.6" "libm.so.6" "libgcc_s.so.= 1" "libc.so.6" "ld-linux-x86-64.so.2") rpath: () runpath: ("/gnu/store/mj14= k58lfc88jhcn6va0s2fpwkv3s35c-llvm-13.0.1/lib" "/gnu/store/5h2w4qi9hk1qzzgi1= w83220ydslinr4s-glibc-2.33/lib" "/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2j= l-gcc-10.3.0-lib/lib" "/gnu/store/094bbaq6glba86h1d4cj16xhdi6fk2jl-gcc-10.3= .0-lib/lib/gcc/x86_64-unknown-linux-gnu/10.3.0/../../..")> --8<---------------cut here---------------end--------------->8--- We could temporarily delete this phase for all 32-bit builds of LLVM. But the crux of the problem is that llvm@15 has a single huge shared library, unlike previous versions: --8<---------------cut here---------------start------------->8--- $ du -hL /gnu/store/bgqdvvi7k6l255332rfawgjmn2hpn13r-llvm-15.0.4/lib/*.so 133M /gnu/store/bgqdvvi7k6l255332rfawgjmn2hpn13r-llvm-15.0.4/lib/libLLVM= -15.0.4.so 96K /gnu/store/bgqdvvi7k6l255332rfawgjmn2hpn13r-llvm-15.0.4/lib/libLTO.= so 16K /gnu/store/bgqdvvi7k6l255332rfawgjmn2hpn13r-llvm-15.0.4/lib/libRema= rks.so --8<---------------cut here---------------end--------------->8--- (It also has tons of .a files, which shouldn=E2=80=99t be there.) Is that big LLVM.so due to different build options on our side? Or is it a radical upstream change (sounds unlikely, but who knows)? Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/build/gremlin.scm b/guix/build/gremlin.scm index 2a74d51dd9..8a38dde1eb 100644 --- a/guix/build/gremlin.scm +++ b/guix/build/gremlin.scm @@ -250,7 +250,11 @@ (define (file-dynamic-info file) info." (call-with-input-file file (lambda (port) - (elf-dynamic-info (parse-elf (get-bytevector-all port)))))) + (elf-dynamic-info (parse-elf + ;; Read at most 10 MiB in memory, which should be + ;; enough to get the PT_DYNAMIC segment. + ;; TODO: mmap the whole file instead. + (get-bytevector-n port (* 10 (expt 2 20)))))))) (define (file-runpath file) "Return the DT_RUNPATH dynamic entry of FILE as a list of strings, or #f if --=-=-=--