On Sat Aug 06 11:25:38 2016, sml...@gmail.com wrote: > Golfed program to demonstrate the problem: > > my $server = IO::Socket::Async.listen('localhost', 3333); > $server.tap: -> $conn { > $conn.Supply.tap: -> $message { say $message.perl } > } > > my $client = IO::Socket::Async.connect('localhost', 3333).then: { > .result.write(Blob.new: 144); > } > > await $client, $server; > > It prints the following, and exits: > > Unhandled exception: Malformed UTF-8 > > In practice, having a server than can be crashed at will by any (even > not-authenticated) client is of course LTA. > It seem the only way to prevent this, is to use .Supply(:bin) to work > with Buf's, which is needlessly cumbersome for text-based protocols. > > I tried to catch the exception in the following ways, to prevent it > from exiting the program, but none had an effect: > > 1) CATCH or try/CATCH in a bunch of different places > 2) Assigning to $*SCHEDULER.uncaught_handler > 3) Specifying a :quit handler for both .tap's
Fixed, and test added in S32-io/IO-Socket-Async.t for this and a couple of other related cases. (Under the hood, the whole way we handle decoding strings with async sockets has been given a good overhaul.) The typical way to handle such errors would be your option 3 (or, if using the supply/whenever syntax, a QUIT phaser). It should now also, as a last gasp, be passed to option 2. /jnthn