[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] utils: Handle errors in worker threads.

From: Ludovic Courtès
Subject: Re: [PATCH] utils: Handle errors in worker threads.
Date: Wed, 05 Feb 2020 16:08:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)


Christopher Baines <address@hidden> 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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]