all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Christopher Baines <mail@cbaines.net>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] utils: Handle errors in worker threads.
Date: Wed, 05 Feb 2020 16:08:48 +0100	[thread overview]
Message-ID: <87mu9xnkan.fsf@gnu.org> (raw)
In-Reply-To: <20200203192027.7944-1-mail@cbaines.net> (Christopher Baines's message of "Mon, 3 Feb 2020 19:20:27 +0000")

Hi,

Christopher Baines <mail@cbaines.net> skribis:

> Previously, if an error occurred, the worker fiber simply never sends a
> reply. In the case of HTTP requests to Cuirass, where an exception occurs when
> performing a database query, the fiber handling the request blocks as it never
> gets a response. I think that this has the potential to cause the process to
> hit file descriptor limits, as the connections are never responded to.
>
> This is fixed by responding with the details of the exception, and then
> throwing it within the fiber that made the call.
>
> * src/cuirass/utils.scm (make-worker-thread-channel): Catch exceptions when
> calling proc.
> (call-with-worker-thread): Handle receiving exceptions from the worker thread.

Good catch!

> +                     (put-message reply
> +                                  (catch
> +                                    #t

Please put #t on the same line as ‘catch’.  :-)

> +                                    (lambda ()
> +                                      (apply proc args))
> +                                    (lambda (key . args)
> +                                      (cons* 'worker-thread-error key args))))))

As discussed with others at the Guix Days, it’s probably a good idea to
distinguish “remote” exceptions from local exceptions like you did (and
unlike what ‘inferior-eval’ does).

LGTM!

Ludo’.

  reply	other threads:[~2020-02-05 15:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 19:20 [PATCH] utils: Handle errors in worker threads Christopher Baines
2020-02-05 15:08 ` Ludovic Courtès [this message]
2020-02-05 18:14   ` Christopher Baines

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=87mu9xnkan.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=mail@cbaines.net \
    /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.