From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4Nj4-0008Hh-Fo for guix-patches@gnu.org; Fri, 06 Apr 2018 05:32:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4Nj0-0002ua-G3 for guix-patches@gnu.org; Fri, 06 Apr 2018 05:32:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:60208) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4Nj0-0002uR-Bj for guix-patches@gnu.org; Fri, 06 Apr 2018 05:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f4Nj0-0006xw-59 for guix-patches@gnu.org; Fri, 06 Apr 2018 05:32:02 -0400 Subject: [bug#30950] [PATCH shepherd]: Update required guile version, and remove some hacks Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87lgefuk4o.fsf@zancanaro.id.au> <87605evdva.fsf@gnu.org> <877eplj742.fsf@zancanaro.id.au> Date: Fri, 06 Apr 2018 11:31:14 +0200 In-Reply-To: <877eplj742.fsf@zancanaro.id.au> (Carlo Zancanaro's message of "Fri, 06 Apr 2018 14:23:25 +1000") Message-ID: <87efjs1y1p.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Carlo Zancanaro Cc: 30950@debbugs.gnu.org Hi Carlo, Carlo Zancanaro skribis: > On Thu, Mar 29 2018, Ludovic Court=C3=A8s wrote: >>> * modules/shepherd.scm (main): Remove SIGALRM hack for guile <=3D >>> 2.0.9. >>> >>> ... >> >> Unfortunately I think the problem remains. That=E2=80=99s one of the >> reasons for using signalfd(2). > > I must not understand this problem. Can you explain what the problem > is, and how this solves it? Reading the linked email didn't help me to > understand. I've read a number of other things about Guile and how it > handles signals and they haven't helped me to understand, either. It=E2=80=99s a limitation/bug in how Guile handles signals. Scheme signal handlers are added to a queue of =E2=80=9Csystem asyncs=E2=80=9D (info "(gu= ile) Asyncs"). As the name implies, those asyncs get executed asynchronously; this is what the =E2=80=98handle-interrupts=E2=80=99 instru= ctions that we see here are for: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,compile (lambda (x) (+ 1 x)) Disassembly of at #xe8: 0 (assert-nargs-ee/locals 1 1) ;; 2 slots (0 args) at (unknown f= ile):139:9 1 (make-non-immediate 0 39) ;; #:139:9 (x)> 3 (handle-interrupts)=20=20=20=20=20=20=20=20=20=20=20=20=20 4 (return-values 2) ;; 1 value Disassembly of at #xfc: 0 (assert-nargs-ee/locals 2 0) ;; 2 slots (1 arg) at (unknown f= ile):139:9 1 (add/immediate 0 0 1) at (unknown f= ile):139:21 2 (handle-interrupts)=20=20=20=20=20=20=20=20=20=20=20=20=20 3 (return-values 2) ;; 1 value Disassembly of at #x10c: 0 (assert-nargs-ee/locals 1 1) ;; 2 slots (0 args) at (unknown f= ile):139:21 1 (static-patch! 32 -5)=20=20=20=20=20=20=20=20=20=20=20 4 (make-short-immediate 0 2052) ;; # 5 (return-values 2) ;; 1 value --8<---------------cut here---------------end--------------->8--- The problem is that if you have a loop around the =E2=80=98select=E2=80=99 = syscall, you could have a situation like this: 1. You receive SIGCHLD; an async is queued by the C signal handler in libguile, and select(2) exits with EINTR. 2. The Scheme code that called the =E2=80=98select=E2=80=99 procedure run= s and loops back to the =E2=80=98select=E2=80=99 call. 3. We=E2=80=99re now back in select(2) but we haven=E2=80=99t executed ou= r signal handler (async), and we know it won=E2=80=99t run until we=E2=80=99ve = returned from select(2), which could be hours away. That=E2=80=99s roughly the story. I would need to =E2=80=9Cpage it in=E2= =80=9D again to think about what can be done. >> Can you create an account on Savannah so I can add you to the group >> and let you push the first two patches? :-) > > I have an activated account, finally! I'm czan there. Awesome, you=E2=80=99re a member now, you can unleash your hacking power. = :-) Cheers, Ludo=E2=80=99.