Skip Menu |
 

This queue is for tickets about the IO-Async CPAN distribution.

Report information
The Basics
Id: 127835
Status: open
Priority: 0/
Queue: IO-Async

People
Owner: Nobody in particular
Requestors: DBOOK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Global loop exception handling
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
Message-ID: <rt-4.0.18-2379-1543446445-465.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 288
Download (untitled) / with headers
text/plain 288b
There's currently no way to add exception handling to all loop callbacks in order to prevent the loop being stopped by an exception. A possible method would be to allow an on_error event handler to be specified for the loop, and if unspecified this would fallback to the current behavior.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-2379-1543446445-465.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-2379-1543446445-465.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-11408-1543488035-721.127835-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 560
Download (untitled) / with headers
text/plain 560b
On Wed Nov 28 18:07:25 2018, DBOOK wrote: Show quoted text
> There's currently no way to add exception handling to all loop > callbacks in order to prevent the loop being stopped by an exception. > A possible method would be to allow an on_error event handler to be > specified for the loop, and if unspecified this would fallback to the > current behavior.
(as discussed on IRC:) Yes this sounds useful behaviour. Probably the way forward is to add a `->configure` method to IO::Async::Loop (and while we're there, migrate the `set_resolver` ability to it) -- Paul Evans
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-2379-1543446445-465.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-2379-1543446445-465.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-15619-1555356520-1306.127835-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 114
Download (untitled) / with headers
text/plain 114b
$loop->configure( on_exception => sub { ... } ); Still need to design what arguments it receives -- Paul Evans
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-15619-1555356520-1306.127835-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-2379-1543446445-465.0-0-0 [...] rt.cpan.org> <rt-4.0.18-15619-1555356520-1306.127835-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-28168-1555358821-1681.127835-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 971
Download (untitled) / with headers
text/plain 971b
Prior art for posterity: POE - exceptions send a fake 'DIE' signal to the kernel, which can be handled by a session and is passed several arguments pertaining to the state of the kernel when the exception occurred. If CATCH_EXCEPTIONS is disabled, events are not run in an eval. https://metacpan.org/pod/POE::Kernel#Exception-Handling EV - exceptions are passed to $EV::DIED, a global coderef which defaults to warning "EV: error in callback (ignoring): $@" and uses $@ directly. Events are always run in an eval and exceptions in $EV::DIED are ignored. https://metacpan.org/pod/EV#$EV::DIED Mojo::IOLoop - exceptions emit an error event on the Mojo::Reactor of "$what failed: $@" - where $what is a brief label of the handler that failed. Error event is fatal by default on its own but Mojo::IOLoop sets up a handler that warns "$reactor_class: $exception" instead. I think that the Mojo::IOLoop strategy is most similar to a reasonable approach for IO::Async::Loop.
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-28168-1555358821-1681.127835-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-2379-1543446445-465.0-0-0 [...] rt.cpan.org> <rt-4.0.18-15619-1555356520-1306.127835-0-0 [...] rt.cpan.org> <rt-4.0.18-28168-1555358821-1681.127835-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-28168-1555358929-1880.127835-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 446
Download (untitled) / with headers
text/plain 446b
On Mon Apr 15 16:07:01 2019, DBOOK wrote: Show quoted text
> Mojo::IOLoop - exceptions emit an error event on the Mojo::Reactor of > "$what failed: $@" - where $what is a brief label of the handler that > failed. Error event is fatal by default on its own but Mojo::IOLoop > sets up a handler that warns "$reactor_class: $exception" instead.
Addendum: events are always run in an eval, and the relevant documentation: https://metacpan.org/pod/Mojo::Reactor#error


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.