Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When testing in parallel, orphaned grandchild pids cause problems with Test2. #113

Open
mvsjes2 opened this issue Apr 5, 2024 · 0 comments

Comments

@mvsjes2
Copy link

mvsjes2 commented Apr 5, 2024

When running tests in parallel, if one of the test classes also creates forks, and any of those 'grandchild' forks dies, it can mess up Test2::ASync and possibly cause other follow-on problems duing global destruction.

To recreate:

Create a parent script to run tests:

use Test::Class::Moose::Load './t';
use Test::Class::Moose::Runner;
my $runner = Test::Class::Moose::Runner->new(jobs => 3);
$runner->runtests;

...and a child class in a 't' subfolder that is set up to die:

package Class1;

use Test::Class::Moose;
use Parallel::ForkManager;

sub test_process {
    my $pm = Parallel::ForkManager->new(1);
    if (!$pm->start) {
        pass;
        die 'grand child object died';
        $pm->finish;
    }
    $pm->wait_all_children;
}

1;

Produces "Attempt to detach from wrong child" from Test2::Async while the test suite is running, and "Subtest can only be finished in the process/thread that created it" during destruction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant