You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system: Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64
Steps to reproduce the behavior
If you start multiple Mojo::IOLoop::Subprocess processes from a for loop, the parent code will get triggered for every one of the created children at every iteration of the loop. What's more annoying is that this is done with undef @results, triggering a Storable error (thaw with an empty buffer).
#!/usr/bin/env perluse feature 'say';
use Mojo::IOLoop;
use Mojo::IOLoop::Subprocess;
# Operation that would block the event loop for 5 secondsfor (0..2) {
my$subprocess = Mojo::IOLoop::Subprocess->new;
$subprocess->run(
sub {
my$subprocess = shift;
sleep 5;
return'♥', 'Mojolicious';
},
sub {
my ($subprocess, $err, @results) = @_;
$pid = $subprocess->pid;
say"Subprocess $pid error: $err"andreturnif$err;
say"Subprocess $pid$results[0] $results[1]!";
}
);
}
# Start event loop if necessary
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
Expected behavior
The parent sub should only be executed once the current child returns.
Actual behavior
The parent code gets triggered once for every child spawned with the run method.
The text was updated successfully, but these errors were encountered:
ggl
changed the title
Multiple Mojo::IOLoop::Subprocess trigger the same parent code
Multiple Mojo::IOLoop::Subprocess trigger the same parent code at runtime
Feb 15, 2017
Steps to reproduce the behavior
If you start multiple Mojo::IOLoop::Subprocess processes from a for loop, the parent code will get triggered for every one of the created children at every iteration of the loop. What's more annoying is that this is done with undef @results, triggering a Storable error (thaw with an empty buffer).
Expected behavior
The parent sub should only be executed once the current child returns.
Actual behavior
The parent code gets triggered once for every child spawned with the
run
method.The text was updated successfully, but these errors were encountered: