Subject: bug#44551: Clients can trigger daemon file descriptor exhaustion

From: Ludovic Courtès <[email-masked]>
Date: Tue, 10 Nov 2020 13:06:32 +0100

Hi!

--8<---------------cut here---------------start------------->8---
$ guix time-machine --branch=version-1.2.0 -- package -A '^r-' | wc -l

[...]

1488
$ r_packages="`guix time-machine --branch=version-1.2.0 -- package -A '^r-' | cut -f1`"
$ guix time-machine --branch=version-1.2.0 -- build --no-grafts $r_packages --max-jobs=20 --keep-going
process 61621 acquired build slot '/var/guix/offload/141.80.167.178:22/1'
normalized load on machine '141.80.167.177' is 0.03
building /gnu/store/ix9x8qzdy3cf0435b7a8p1gl77vcn82c-r-shinycssloaders-1.0.0.drv...
process 61683 acquired build slot '/var/guix/offload/141.80.167.178:22/1'
process 61683 acquired build slot '/var/guix/offload/141.80.167.172:22/1'

[...]

normalized load on machine '141.80.167.178' is 0.01
building /gnu/store/7ws1c6nkxkgkb86qdcgy9lq483jz5rf4-r-shinydashboard-0.7.1.drv...
process 61725 acquired build slot '/var/guix/offload/141.80.167.171:22/4'
process 61725 acquired build slot '/var/guix/offload/141.80.167.159:22/2'

[...]

normalized load on machine '141.80.167.171' is 0.16
building /gnu/store/j6walvqfdbavr56ymlnivnrc1z07yjfp-r-shinyfiles-0.8.0.drv...
guix build: error: creating pipe: Too many open files
--8<---------------cut here---------------end--------------->8---

On closer inspection, it seems that the guix-daemon for that session
opens each .drv file along with the corresponding .lock file, and spawns
one ‘guix offload’ process for each (?) and creates one pipe per offload
process:

--8<---------------cut here---------------start------------->8---
$ sudo guix processes| recsel -e 'ClientCommand ~ "r-biasedurn"'
SessionPID: 3412
ClientPID: 3343
ClientCommand: /gnu/store/b7rixb64yp00znz0d5rwd5zzklwzlzmv-guile-wrapper/bin/guile --no-auto-compile /home/ludo/.cache/guix/inferiors/pnxkhd7va5d3u5jas4mwsbic4vrkcbyv2too7sd74xd5vjyz54pq/bin/guix build --no-grafts r-a3 r-a4 r-a4base r-a4classif r-a4core r-a4preproc r-a4reporting r-aasea r-abacus r-abadata r-abaenrichment r-abbyyr r-abc r-abc-data r-abc-rap r-abcadm r-abcanalysis r-abcdefba r-abcoptim r-abcp2 r-abcrf r-abcrlda r-abctools r-abd r-abe r-abemus r-abf2 r-abhgenotyper r-abind r-abjutils r-abn r-abnormality r-abodoutlier r-abps r-abseqr r-absfiltergsea r-absim r-abstractr r-abtest r-abundant r-ac3net r-aca r-acc r-accelerometry r-accelmissing r-accept r-acceptancesampling r-acclma r-accrual r-accrued r-accsda r-acd r-acdm r-ace2fastq r-acebayes r-acepack r-acet r-acfmperiod r-acid r-acm4r r-acmeeqtl r-acmer r-acnr r-acopula r-acousticndlcoder r-acp r-acrm […]
LockHeld: /gnu/store/mi6ydc4w47nrsw2ycsyssc2hlpl5jvlb-r-biclust-2.0.2.lock
LockHeld: /gnu/store/zypp435ii1sd256p1bapgvk06p2kc6rq-r-bifet-1.8.0.lock
LockHeld: /gnu/store/x316v7js7rj0wjhvynf3mn3ppxqqnghg-r-bigpint-1.4.0.lock
LockHeld: /gnu/store/jxs6h5f1cvlz7dmmifr3qf3skzziklwa-r-bigrquery-1.3.2.lock
LockHeld: /gnu/store/sw55r4wj1bgj2aqkl1gyqifk077iyvlc-r-aasea-1.1.0.lock
LockHeld: /gnu/store/r4331w4h693zl3596i9cnb0z7437aghp-r-bisquerna-1.0.4.lock
LockHeld: /gnu/store/13jggpxjxzjpbvwfx5vwdscvz5z5md88-r-cdm-7.5-15.lock
LockHeld: /gnu/store/bfvfb4wk1q9idfj3gdi1j7zhp5kj21kw-r-chemminer-3.40.0.lock
LockHeld: /gnu/store/2q0pibjmqd51dx331l4iz1xby868y7d3-r-chipkernels-1.1-1.c9cfcacb6.lock
LockHeld: /gnu/store/f195yyipwhhz1cdyvvwvcwd9n93bbgxk-r-chippeakanno-3.22.4.lock
LockHeld: /gnu/store/2igc78ipanbr0cgj508jxq94pqldirlx-r-circus-0.1.5.lock
LockHeld: /gnu/store/sr3h7hxzkjq8kh17f4clb27d5w6li34j-r-citr-0.3.2.lock
LockHeld: /gnu/store/cz7iffxh03mqf0651vxg6669aq31f039-r-cssam-1.4-1.9ec58c9.lock
LockHeld: /gnu/store/6xlx6mbvi6mz44kyps36vlw05r085k9s-r-ddrtree-0.1.5.lock
LockHeld: /gnu/store/6d0j0a5i8vz966w66b76w5gpb9xdpc2m-r-dnabarcodes-1.18.0.lock
LockHeld: /gnu/store/d6c5i3f41hfz4sacgmjc64x78rfk4f1p-r-abstractr-0.1.0.lock
LockHeld: /gnu/store/2kzzqdglrja1fr34jcp51vk8hw6ajk3i-r-dorng-1.8.2.lock
LockHeld: /gnu/store/5rvg6vaa5h5bxqxcw3nd7hl5695m64dz-r-dvmisc-1.1.4.lock
[…]
ChildProcess: 10012:
ChildProcess: 10056:
ChildProcess: 10156:
ChildProcess: 10228:
ChildProcess: 10275:
ChildProcess: 10331: /gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4/bin/guile \ /gnu/store/c6y2fijkw5v0b6jm336h7pvvzd2wm0yd-guix-1.1.0-30.875c01f/bin/.guix-real offload x86_64-linux 3600 1 21600
ChildProcess: 10384:
ChildProcess: 10440:
ChildProcess: 10485:
ChildProcess: 10545:
ChildProcess: 10603:
[…]
$ sudo ls -l /proc/3412/fd                                                                                total 0
lr-x------ 1 root root 64 Nov 10 13:02 0 -> /dev/null
l-wx------ 1 root root 64 Nov 10 13:02 1 -> /var/log/guix-daemon.log
lr-x------ 1 root root 64 Nov 10 13:02 10 -> 'pipe:[1555282836]'
l-wx------ 1 root root 64 Nov 10 13:02 100 -> 'pipe:[1555302732]'
l-wx------ 1 root root 64 Nov 10 13:02 101 -> /var/log/guix/drvs/ph/3347q47fzm7p7xqxrg2yaczq32yhry-r-biasedurn-1.07.drv.gz
lrwx------ 1 root root 64 Nov 10 13:02 102 -> /gnu/store/mi6ydc4w47nrsw2ycsyssc2hlpl5jvlb-r-biclust-2.0.2.lock
lr-x------ 1 root root 64 Nov 10 13:02 103 -> 'pipe:[1555309592]'
lr-x------ 1 root root 64 Nov 10 13:02 104 -> 'pipe:[1554900787]'
l-wx------ 1 root root 64 Nov 10 13:02 105 -> 'pipe:[1554900787]'
l-wx------ 1 root root 64 Nov 10 13:02 106 -> /var/log/guix/drvs/cy/d6a29xcj8mpz2d2wwr74qz0wls25sh-r-biclust-2.0.2.drv.gz
lrwx------ 1 root root 64 Nov 10 13:02 107 -> /gnu/store/zypp435ii1sd256p1bapgvk06p2kc6rq-r-bifet-1.8.0.lock
lr-x------ 1 root root 64 Nov 10 13:02 108 -> 'pipe:[1555297615]'
lr-x------ 1 root root 64 Nov 10 13:02 109 -> 'pipe:[1555309594]'
l-wx------ 1 root root 64 Nov 10 13:02 11 -> /var/log/guix/drvs/my/p71npacpg71brl7cnjs5235kxvvvmk-r-a4base-1.36.0.drv.gz
l-wx------ 1 root root 64 Nov 10 13:02 110 -> 'pipe:[1555309594]'
l-wx------ 1 root root 64 Nov 10 13:02 111 -> /var/log/guix/drvs/n8/kr70pvr00zvssfmdqwx0jwk7yrmynj-r-bifet-1.8.0.drv.gz
lrwx------ 1 root root 64 Nov 10 13:02 112 -> /gnu/store/x316v7js7rj0wjhvynf3mn3ppxqqnghg-r-bigpint-1.4.0.lock
lr-x------ 1 root root 64 Nov 10 13:02 113 -> 'pipe:[1555310888]'
lr-x------ 1 root root 64 Nov 10 13:02 114 -> 'pipe:[1555297617]'
l-wx------ 1 root root 64 Nov 10 13:02 115 -> 'pipe:[1555297617]'
l-wx------ 1 root root 64 Nov 10 13:02 116 -> /var/log/guix/drvs/8c/hs0dfimv9jmr99825860x32wfhifva-r-bigpint-1.4.0.drv.gz
lrwx------ 1 root root 64 Nov 10 13:02 117 -> /gnu/store/jxs6h5f1cvlz7dmmifr3qf3skzziklwa-r-bigrquery-1.3.2.lock
lr-x------ 1 root root 64 Nov 10 13:02 118 -> 'pipe:[1555299601]'
lr-x------ 1 root root 64 Nov 10 13:02 119 -> 'pipe:[1555310890]'
lrwx------ 1 root root 64 Nov 10 13:02 12 -> /gnu/store/sw55r4wj1bgj2aqkl1gyqifk077iyvlc-r-aasea-1.1.0.lock
l-wx------ 1 root root 64 Nov 10 13:02 120 -> 'pipe:[1555310890]'
l-wx------ 1 root root 64 Nov 10 13:02 121 -> /var/log/guix/drvs/lg/0b9ip4fg2ar1qjbz6v8xrc9iyfgjma-r-bigrquery-1.3.2.drv.gz
[…]
--8<---------------cut here---------------end--------------->8---

Ludo’.