Skip to content

Fix session_write_failure_keeps_data.phpt on gcov builds - #25015

Closed
Truta446 wants to merge 1 commit into
php:PHP-8.4from
Truta446:session-write-failure-rlimit
Closed

Truta446 wants to merge 1 commit into
php:PHP-8.4from
Truta446:session-write-failure-rlimit

Conversation

@Truta446

Copy link
Copy Markdown

The master COVERAGE nightly has failed every day since Oct 22 on ext/session/tests/session_write_failure_keeps_data.phpt. The expected output matches, but the test ends with Termsig=25 (SIGXFSZ).

The test sets RLIMIT_FSIZE to 0 and ignores SIGXFSZ so the session write fails with EFBIG. The limit is never lifted, and pcntl's RSHUTDOWN puts SIGXFSZ back to SIG_DFL. On a gcov build the process then writes its .gcda files at exit, gets SIGXFSZ and dies.

It has been broken since the test was added. It only started showing up after the Oct 21 security merge changed run-tests to wait for the child to exit before checking how it ended. Before that, proc_get_status() ran while gcov was still dumping, so the signal was never seen.

The fix restores the soft limit right after the failed write. The test already raises the hard limit to RLIMIT_INFINITY, so this works without privileges.

I targeted PHP-8.4 because the test is identical there and on every branch up to master.

Tested on PHP-8.4 debug+gcov: ext/session/tests went from 1 failure to 0, with and without opcache. On a master gcov build the test fails 10 out of 10 runs without the change and passes 10 out of 10 with it. The ASan suite passes both ways. I also checked that the test still catches the truncation bug it was written for, by reverting the mod_files.c part of c2b02f2.

The test lowers RLIMIT_FSIZE to zero and ignores SIGXFSZ so that the
session write fails with EFBIG. It never lifts the limit again, and
pcntl's RSHUTDOWN resets SIGXFSZ back to SIG_DFL. On a gcov build the
counters are written to .gcda files at exit, which raises SIGXFSZ and
kills the process after the expected output has been printed.

This fails the master COVERAGE nightly every day since run-tests started
waiting for the child to exit before checking how it terminated; before
that the signal was missed because the process was still running.

Restore the limit right after the failed write.
@jorgsowa

Copy link
Copy Markdown
Contributor

Thank you for report, but it's duplicate #24401

@jorgsowa jorgsowa closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants