Used to flag any tasks involving a Zend PHP segmentation fault.
Details
Thu, Feb 5
@tstarling: This task has been assigned to you a while ago. Is this still a valid (open) task which requires more work, or do you assume this got fixed by T389734?
Apr 4 2025
All Excimer segfault bugs are now suspected duplicates of T389734, i.e. glibc timer aliasing, glibc#32833.
Sep 14 2024
Feb 29 2024
Found the issue and resolved it. I ran composer run --timeout=0 phpunit:entrypoint -- --group Database --exclude-group Broken,ParserFuzz,Stub,Standalone --debug (with --debug) to see which test causes this which narrowed things down.
Test 'ObjectCacheTest::testNewAnythingAccel' started Segmentation fault Script phpunit handling the phpunit event returned with error code 139 Script @phpunit was called via phpunit:entrypoint ``
root@cf3df63ff3fa:/var/www/html/w# composer run --timeout=0 phpunit:entrypoint -- --group Database --exclude-group Broken,ParserFuzz,Stub,Standalone Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9000 (through xdebug.client_host/xdebug.client_port). > phpunit '--group' 'Database' '--exclude-group' 'Broken,ParserFuzz,Stub,Standalone' Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9000 (through xdebug.client_host/xdebug.client_port). Using PHP 8.1.20 Running with MediaWiki settings because there might be integration tests PHPUnit 9.6.16 by Sebastian Bergmann and contributors.
From the logs, your code triggers a segfault when running PHP, which is probably an upstream bug in PHP rather than a bug in your code per se.
Jan 31 2024
Dec 14 2023
Nov 13 2023
You would the Linux Kernel to generate a core dump when php crashes. Running the jobs with ulimit -c unlimited should enable that and once a core file has been acquired, remove the setting to avoid filing disk.
Nov 9 2023
Oct 2 2023
Aug 30 2023
docker-registry.discovery.wmnet/dev/buster-swift53 failed cause of an outdated gpg key.
Aug 29 2023
Aug 25 2023
Most likely opcache corruption. Errors started only 1ms after the request timeout at 12:36:03.013, and then there was a flood of segfaults over the next few hundred milliseconds, finishing with "[WARNING] failed processes threshold (40 in 60 sec) is reached, initiating reload" at 12:36:03.800.
Jul 31 2023
This is fixed and released in LuaSandbox 4.1.1.
Jul 28 2023
I have published the result of this debugging as Blog Post: Investigate a PHP segmentation fault
Jul 27 2023
Jul 26 2023
And eventually it is fixed:
16:30:26 <wmf-insecte> Project beta-update-databases-eqiad build #69029: FIXED in 10 min: https://integration.wikimedia.org/ci/job/beta-update-databases-eqiad/69029/
Mentioned in SAL (#wikimedia-releng) [2023-07-26T15:29:52Z] <jnuche> reenabled https://integration.wikimedia.org/ci/view/Beta/job/beta-update-databases-eqiad/ Should be fixed now! https://phabricator.wikimedia.org/T342769
Possibly caused by errant user input that wasn't stopped.
Mentioned in SAL (#wikimedia-releng) [2023-07-26T15:04:22Z] <jnuche> disabled https://integration.wikimedia.org/ci/view/Beta/job/beta-update-databases-eqiad/ after debugging is done. See https://phabricator.wikimedia.org/T342769
After I have remembered PHP provides some gdb helpers ( .gdbinit in php-7.4.30 branch), I have added it to my home dir and loaded it with gdb> source /home/hashar/gdbinit.
[10:41:48] <+hashar> [0x7fffcb44b710] preg_match("\7^Z[1-9]\d*$\7u", "Z1002") [internal function]
[10:41:48] <+hashar> [0x7fffcb44aba0] Opis\JsonSchema\Validator->validateString(reference, reference, array(0)[0x7fffcb44ac10], array(7)[0x7fffcb44ac20], object[0x7fffcb44ac30], object[0x7fffcb44ac40], object[0x7fffcb44ac50]) /srv/mediawiki-staging/php-master/vendor/opis/json-schema/src/Validator.php:1219
[10:41:48] <+hashar> [0x7fffcb44a760] Opis\JsonSchema\Validator->validateProperties(reference, reference, array(0)[0x7fffcb44a7d0], array(7)[0x7fffcb44a7e0], object[0x7fffcb44a7f0], object[0x7fffcb44a800], object[0x7fffcb44a810], NULL) /srv/mediawiki-staging/php-master/vendor/opis/json-schema/src/Validator.php:943
[10:42:00] <+hashar> I will paste the details and the first few lines on the task
[10:43:05] <+hashar> I guess the regex does an infinite loop
[10:43:20] <+hashar> or whatever really I don't know
[10:46:18] <James_F> hashar: OK, so that's probably coming from extensions/WikiLambda/function-schemata/data/CANONICAL/Z9.yamlSo Instead of messing up with systemd / coredump / ulimit I went to invoke the php command under GDB based on a previous issue T296539#7531235
Mentioned in SAL (#wikimedia-releng) [2023-07-26T14:02:48Z] <hashar> deployment-prep: on deployment-deploy03, installed php / libpcre debugging symbols for T342769: sudo apt-get install php7.4-common-dbgsym php7.4-cli-dbgsym libpcre2-dbg
I have changed /etc/systemd/coredump.conf:
- KeepFree=20% + KeepFree=4G
But that comes from Puppet. I have thus disabled the Puppet agent for now and have set the value to 4G. The core file should then be stored under /var/lib/systemd/coredump.
Jul 25 2023
Jul 18 2023
Thanks, this is great!
Jul 17 2023
It would seem that there's a critical section between zend_object_std_init() and the assignment of handlers, during which time it's unsafe to call emalloc().
Change 938925 merged by jenkins-bot:
[mediawiki/php/luasandbox@master] Fix segmentation fault when memory limit is exceeded in LuaSandbox init
Change 938925 had a related patch set uploaded (by TK-999; author: TK-999):
[mediawiki/php/luasandbox@master] Fix segmentation fault when memory limit is exceeded in LuaSandbox init
I think this is not a PHP 8.0 specific issue, it'd likely happen on earlier versions as well. We just happened to notice it because we were on the lookout for core dumps while investigating unrelated JIT issues.
Thanks a lot, Tim :)- using your advice, I inspected a more recent dump and found that it was a request where PHP was exceeding its configured memory limit while it was parsing a rather complex page. Going by that, I managed to narrow it down to a consistent reproducer:
--TEST--
Memory limit exceeded during sandbox init
--INI--
memory_limit=2M
--FILE--
<?php
$buf = str_repeat('a', 1000000);
$sandboxes = [];
for ($i = 0; $i < 100; $i++) {
$sandboxes[] = new LuaSandbox();
}
?>
--EXPECTF--
Fatal error: Allowed memory size of 2097152 bytes exhausted%s(tried to allocate %d bytes) in %s on line %dJul 12 2023
Jul 11 2023
Given the previous comment, is there any reason to keep this task protected at this point? I'm not seeing one.
Jul 10 2023
Change 936327 merged by jenkins-bot:
[mediawiki/core@master] docker: update to latest published images
