The codeception version i'm using is super old. This is being posted for awareness.
Running a codeception.yml with multiple suites under a single config, using Symfony 2.8.3
Specific versions in play:
- Symfony 2.8.3 (7a9a5fce7ce6e448e527f635463dda00761e12c2)
- Codeception 2.2.4 (ea617b8b55e6e33cdd47edeafde5d3f6466049e2)
- PHP 5.6.30-0+deb8u1 (cli) (built: Feb 8 2017 08:50:21) (Zend OPcache v7.0.6-dev) (without xdebug)
- Debian GNU/Linux 8 (jessie)
Upon executing the second suite, a segfault occurs.
www-data@3d637da61efa[/var/www/tms] $ bin/codecept -c ./tests run
Codeception PHP Testing Framework v2.2.4
Powered by PHPUnit 5.2.10 by Sebastian Bergmann and contributors.
tests.Environment Tests (9) ---------------------------------------------------------------------------------------------------------
Testing Elmo\tests.Environment
✔ PermissionsTest: Symfony directories are writable (0.11s)
✔ PermissionsTest: Content directories are writable (0.05s)
I PermissionsTest: Readonly directories (0.01s)
✔ ApacheTest: Php modules (0.01s)
✔ CacheTest: Cache service (0.01s)
✔ DatabaseTest: Database service (35.72s)
✔ EmailTest: Email service (120.17s)
✔ SessionTest: Session service (0.07s)
I SolrTest: Solr service (0.00s)
------------------------------------------------------------------------------------------------------------------------------------------
tests.Acceptance Tests (1) ----------------------------------------------------------------------------------------------------------
⏺ Recording ⏺ step-by-step screenshots will be saved to /var/www/tms/tests/./_log/
Directory Format: record_58ab9be63cd92_{testname} ----
- HomepageCest: Check the homepage loads
Remaining deprecation notices (10)
The Symfony\Component\DependencyInjection\Container::isScopeActive method is deprecated since version 2.8 and will be removed in 3.0: 10x
10x in Application::run from Codeception
Debugged the core dump, and traced it to an infinite loop in the Deprecation message error handler.
\Codeception\Subscriber\ErrorHandler
What I'm seeing is, after the first suite finished (Environment, in my example), the ErrorHandler is registered a second time, ontop of itself. For reasons I haven't spent enough time to figure out, this leads to an infinite loop of:
\Codeception\Subscriber\ErrorHandler::handleDeprecationError
\Codeception\Subscriber\ErrorHandler::errorHandler
\Codeception\Subscriber\ErrorHandler::handleDeprecationError
\Codeception\Subscriber\ErrorHandler::errorHandler
This second registration happens because \Codeception\Subscriber\ErrorHandler
is registered by \Codeception\Subscriber\ErrorHandler::handle
, which is attached to the Events::SUITE_BEFORE
event. Effectively when every suite starts, it attaches the error handler.
shutdownHandler
is supposed to de-register the handler, and this is attached to register_shutdown_function
, but this doesn't appear to get called in this code flow (does codeception shutdown between suites?)
The deprecation warning is triggered very early in the lifecycle of Symfony 2.8.3 (and ~4000 are thrown for reasons I won't get into).
I was able to fix it on Codeception 2.2.4 by removing the register_shutdown_function
item, and instead tying shutdownHandler
to the Events::SUITE_AFTER
event.
public static $events = [
Events::SUITE_BEFORE => 'handle',
Events::SUITE_AFTER => 'shutdownHandler',
];
This issue is fixed in latest Codeception since: Codeception/Codeception#3607 https://github.com/Codeception/Codeception/commit/5a6a1077aef10bfd9c36906ec8e099d236e4a2e4
Specifically the $initialised prop prevents this from occurring.