all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Carlo Zancanaro <carlo@zancanaro.id.au>
Cc: 30950@debbugs.gnu.org
Subject: [bug#30950] [PATCH shepherd]: Update required guile version, and remove some hacks
Date: Fri, 06 Apr 2018 11:31:14 +0200	[thread overview]
Message-ID: <87efjs1y1p.fsf@gnu.org> (raw)
In-Reply-To: <877eplj742.fsf@zancanaro.id.au> (Carlo Zancanaro's message of "Fri, 06 Apr 2018 14:23:25 +1000")

Hi Carlo,

Carlo Zancanaro <carlo@zancanaro.id.au> skribis:

> On Thu, Mar 29 2018, Ludovic Courtès wrote:
>>> * modules/shepherd.scm (main): Remove SIGALRM hack for guile <=
>>> 2.0.9.
>>>
>>> ...
>>
>> Unfortunately I think the problem remains.  That’s 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’s a limitation/bug in how Guile handles signals.  Scheme signal
handlers are added to a queue of “system asyncs” (info "(guile)
Asyncs").  As the name implies, those asyncs get executed
asynchronously; this is what the ‘handle-interrupts’ instructions that
we see here are for:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,compile (lambda (x) (+ 1 x))
Disassembly of <unnamed function> at #xe8:

   0    (assert-nargs-ee/locals 1 1)    ;; 2 slots (0 args)   at (unknown file):139:9
   1    (make-non-immediate 0 39)       ;; #<procedure 12fea68 at <unknown port>:139:9 (x)>
   3    (handle-interrupts)             
   4    (return-values 2)               ;; 1 value


Disassembly of <unnamed function> at #xfc:

   0    (assert-nargs-ee/locals 2 0)    ;; 2 slots (1 arg)    at (unknown file):139:9
   1    (add/immediate 0 0 1)                                 at (unknown file):139:21
   2    (handle-interrupts)             
   3    (return-values 2)               ;; 1 value


Disassembly of <unnamed function> at #x10c:

   0    (assert-nargs-ee/locals 1 1)    ;; 2 slots (0 args)   at (unknown file):139:21
   1    (static-patch! 32 -5)           
   4    (make-short-immediate 0 2052)   ;; #<unspecified>
   5    (return-values 2)               ;; 1 value
--8<---------------cut here---------------end--------------->8---

The problem is that if you have a loop around the ‘select’ 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 ‘select’ procedure runs and loops
     back to the ‘select’ call.

  3. We’re now back in select(2) but we haven’t executed our signal
     handler (async), and we know it won’t run until we’ve returned from
     select(2), which could be hours away.

That’s roughly the story.  I would need to “page it in” 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’re a member now, you can unleash your hacking power.  :-)

Cheers,
Ludo’.

      reply	other threads:[~2018-04-06  9:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 11:55 [bug#30950] [PATCH shepherd]: Update required guile version, and remove some hacks Carlo Zancanaro
2018-03-29 20:14 ` Ludovic Courtès
2018-03-29 20:31   ` Leo Famulari
2018-03-29 21:36     ` Carlo Zancanaro
2018-03-30  8:09       ` Ludovic Courtès
2018-03-29 21:27   ` Carlo Zancanaro
2018-04-06  4:23   ` Carlo Zancanaro
2018-04-06  9:31     ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87efjs1y1p.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=30950@debbugs.gnu.org \
    --cc=carlo@zancanaro.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.