[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/07: linux-container: Work around EBADF errors upon exit.
From: |
Ludovic Courtès |
Subject: |
04/07: linux-container: Work around EBADF errors upon exit. |
Date: |
Mon, 15 Jan 2018 17:29:40 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 95aa64bc48cae061effafa7675ea9d9ccbe311a4
Author: Ludovic Courtès <address@hidden>
Date: Mon Jan 15 16:01:10 2018 +0100
linux-container: Work around EBADF errors upon exit.
Typically 'read-pid-file/container' would fail when starting services in
containers such as BitlBee.
* gnu/build/linux-container.scm (call-with-clean-exit): Use
'primitive-_exit' instead of 'primitive-exit'.
(container-excursion*): Close OUT.
---
gnu/build/linux-container.scm | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index 70e7894..65e1325 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 David Thompson <address@hidden>
-;;; Copyright © 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2017, 2018 Ludovic Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -61,9 +61,14 @@ exists."
(const #t)
(lambda ()
(thunk)
- (primitive-exit 0))
+
+ ;; XXX: Somehow we sometimes get EBADF from write(2) or close(2) upon
+ ;; exit (coming from fd finalizers) when used by the Shepherd. To work
+ ;; around that, exit forcefully so fd finalizers don't have a chance to
+ ;; run and fail.
+ (primitive-_exit 0))
(lambda ()
- (primitive-exit 1))))
+ (primitive-_exit 1))))
(define (purify-environment)
"Unset all environment variables."
@@ -335,7 +340,8 @@ return the exit status."
(match (container-excursion pid
(lambda ()
(close-port in)
- (write (thunk) out)))
+ (write (thunk) out)
+ (close-port out)))
(0
(close-port out)
(let ((result (read in)))
- branch master updated (b640370 -> c181636), Ludovic Courtès, 2018/01/15
- 01/07: offload: Look at machine loads for the past minute., Ludovic Courtès, 2018/01/15
- 03/07: ui: Disable '%fresh-auto-compile' only for Guile 2.2.3., Ludovic Courtès, 2018/01/15
- 07/07: services: bitlbee: Add test., Ludovic Courtès, 2018/01/15
- 02/07: doc: Connect "guix archive", "guix pack", and co., Ludovic Courtès, 2018/01/15
- 06/07: doc: Deprecate 'bitlbee-service' procedure., Ludovic Courtès, 2018/01/15
- 04/07: linux-container: Work around EBADF errors upon exit.,
Ludovic Courtès <=
- 05/07: services: bitlbee: Move to (gnu services messaging)., Ludovic Courtès, 2018/01/15