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

Test ends with exit code 139 #268

Closed
milo opened this issue Oct 28, 2015 · 7 comments
Closed

Test ends with exit code 139 #268

milo opened this issue Oct 28, 2015 · 7 comments
Labels
bug

Comments

@milo
Copy link
Member

@milo milo commented Oct 28, 2015

Nette Tester 1.6.1 is failing with exit code 139. The 1.6.0 is OK. Discovered here.

I tried to reproduce it. Successfully, but only once. I clonned the nextras/dbal repo, composer update and run vendor/bin/tester tests/cases/integration/DbalExtensionTest.phpt. It failed on first run, but never on next. Googling for 139 exit... in UNIX usually means SIGSEGV 11 (139 - 128 = 11).

Imho, this is the PHP bug. I'll digging deeper later.

Ref nextras/dbal#18

@Mikulas

This comment has been minimized.

Copy link
Contributor

@Mikulas Mikulas commented Oct 28, 2015

Thanks :) I wanted to create an issue here with a smaller reproducible snippet.

It indeed seems like a php bug.

@milo

This comment has been minimized.

Copy link
Member Author

@milo milo commented Oct 28, 2015

Snippets are welcomed :)

@milo

This comment has been minimized.

Copy link
Member Author

@milo milo commented Oct 31, 2015

This is a Tester's bug. Code to reproduce (it does not print error, only 255 exit code)

include __DIR__ . '/../../../vendor/autoload.php';

class BugTest extends Tester\TestCase
{
    /** @dataProvider data */
    public function testMe($step)
    {
        if ($step === 1) {
            set_error_handler(function() {});
        } else {
            @trigger_error('Loop me');
        }
    }

    protected function data()
    {
        return [[1], [2]];
    }
}

(new BugTest())->run();

The problem is, an error handler is registered in a first call of test method (first data provider entry) and error/warning occures in second test method call (second data provider entry). It causes a loop.

The stack trace of nextras/dbal test case is:

# The first data provider entry
-> set_error_handler() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:127
    -> set_error_handler() /nextras/dbal/vendor/tracy/tracy/src/Tracy/Debugger.php:169
        -> set_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:97
        -> restore_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:101
        -> set_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:97
        -> restore_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:101
        -> set_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:97
        -> restore_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:101
        -> set_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:97
        -> restore_error_handler() /nextras/dbal/vendor/nette/utils/src/Utils/Callback.php:101
    ! There is no error_handler_restore() from Tracy
-> restore_error_handler() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:142

# The second data provider entry
-> set_error_handler() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:127
    -> call_user_func_array:{/nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120}() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120
        -> call_user_func_array:{/nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120}() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120
            -> call_user_func_array:{/nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120}() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120
                -> call_user_func_array:{/nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120}() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120
                    -> call_user_func_array:{/nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120}() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120
                        -> call_user_func_array:{/nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120}() /nextras/dbal/vendor/nette/tester/src/Framework/TestCase.php:120

The loop starts in here when trying to call previous error handler.

Currently I have no idea how to solve it.

milo added a commit to milo/tester that referenced this issue Nov 2, 2015
The error handler has to be installed only once to catch errors from unknown user code. It's because the user can setup own handler and our restore_error_handler() would restore user's handler, not our own.
@hrach

This comment has been minimized.

Copy link

@hrach hrach commented Nov 18, 2015

Any progress here? I would like not to polute the composer with disallowing one particular ntester version.

@milo

This comment has been minimized.

Copy link
Member Author

@milo milo commented Nov 26, 2015

Imho fixed by milo@d545e28, but I'm waiting for some feedback.

@hrach

This comment has been minimized.

Copy link

@hrach hrach commented Nov 26, 2015

From David, Mikulas, or anobody else?

@milo

This comment has been minimized.

Copy link
Member Author

@milo milo commented Nov 26, 2015

From anyone affected by this bug.

@milo milo closed this in 3a56b40 Nov 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.