From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: [PATCH] utils: Handle errors in worker threads. Date: Wed, 05 Feb 2020 16:08:48 +0100 Message-ID: <87mu9xnkan.fsf@gnu.org> References: <20200203192027.7944-1-mail@cbaines.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:57513) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izMIN-0001E9-Dl for guix-devel@gnu.org; Wed, 05 Feb 2020 10:08:52 -0500 In-Reply-To: <20200203192027.7944-1-mail@cbaines.net> (Christopher Baines's message of "Mon, 3 Feb 2020 19:20:27 +0000") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: Christopher Baines Cc: guix-devel@gnu.org Hi, Christopher Baines 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 wh= en > calling proc. > (call-with-worker-thread): Handle receiving exceptions from the worker th= read. Good catch! > + (put-message reply > + (catch > + #t Please put #t on the same line as =E2=80=98catch=E2=80=99. :-) > + (lambda () > + (apply proc args)) > + (lambda (key . args) > + (cons* 'worker-thread-error key ar= gs)))))) As discussed with others at the Guix Days, it=E2=80=99s probably a good ide= a to distinguish =E2=80=9Cremote=E2=80=9D exceptions from local exceptions like = you did (and unlike what =E2=80=98inferior-eval=E2=80=99 does). LGTM! Ludo=E2=80=99.