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
Quite often I realise I need to do some changes in feature fields before behat execution in docker completes, so I press CTRL-C to stop it. But the CTRL-C does not work the same in PHP inside docker and so the selenium session does not get terminated properly and because there is a default maximum session limit of 1 in standalone chrome selenium then the next behat gets stuck for 300 seconds until the selenium session times out (or until you restart selenium).
Workaround is to increase the maximum number of sessions like this
services:
selenium:
ports:
- "${MOODLE_DOCKER_SELENIUM_VNC_PORT}:5900"
environment:
# Workaround for https://github.com/SeleniumHQ/docker-selenium/issues/227
"no_proxy": localhost
# Allow new behat after CTRL-C, the aborted sessions will time out in 300 seconds by default.
SE_NODE_MAX_SESSIONS: 8
SE_NODE_OVERRIDE_MAX_SESSIONS: true
Aaaaah, the problem was that the moodle php image does not have PCNTL installed, this change adds support for it in root/tmp/setup/php-extensions.sh in moodle-php-apache image:
but it is not all that is necessary there to fix the problem completely
Actually sometimes the ctrl-c works fine and the selenium session gets closed during shutdown, but in most cases it says "^CSegmentation fault" and the selenium session is left to time out, so I guess it would be sae to add higher limit anyway.
I think I found it, it seems that the shutdown manager is interfering with CTRL-C handling in vendor/behat/behat/src/Behat/Testwork/EventDispatcher/Cli/SigintController.php
this fixes it for me when using vendor/bin/behat:
if (!defined('BEHAT_TEST') || !BEHAT_TEST) {
pcntl_signal(SIGINT, ['core_shutdown_manager', 'signal_handler']);
}
vendor/bin/behat --config /var/www/behatdata/behatrun/behat/behat.yml
skodak@mbair work % behat --tags=@javascript
Moodle 4.3.6 (Build: 20240812), a9c7e741f2bb748394ffbd9a093f4c5cb4e21f14
Php: 8.1.29, pgsql: 15.2 (Debian 15.2-1.pgdg110+1), OS: Linux 6.10.0-linuxkit aarch64
Run optional tests:
- Accessibility: Yes
Server OS "Linux", Browser: "chrome"
Started at 24-08-2024, 21:03
........^C
No scenarios
8 steps (8 passed)
0m5.88s (75.02Mb)
Quite often I realise I need to do some changes in feature fields before behat execution in docker completes, so I press CTRL-C to stop it. But the CTRL-C does not work the same in PHP inside docker and so the selenium session does not get terminated properly and because there is a default maximum session limit of 1 in standalone chrome selenium then the next behat gets stuck for 300 seconds until the selenium session times out (or until you restart selenium).
Workaround is to increase the maximum number of sessions like this
skodak@c180ab2
I wanted to ask you guys, is there is a better way to deal with CTRL-C so that standard PHP signal handling works as usual?
The text was updated successfully, but these errors were encountered: