Skip to content

EH_THROW window: one mechanism, and tests that need no database - #215

Merged
EdmondDantes merged 2 commits into
mainfrom
tests/eh-window-without-a-database
Jul 31, 2026
Merged

EH_THROW window: one mechanism, and tests that need no database#215
EdmondDantes merged 2 commits into
mainfrom
tests/eh-window-without-a-database

Conversation

@EdmondDantes

@EdmondDantes EdmondDantes commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #214, against php-src true-async-stable bfb4525597.

Tests. 016 as merged held the window open with a PDO connect to an unroutable address and gave the victim 50 ms to run inside it. If the network answered quickly the window was already closed by then, and the test passed without exercising anything — green either way. A userland stream wrapper under DirectoryIterator reaches the same zend_replace_error_handling(EH_THROW, …) window and parks inside it on a timer we control, so both halves are covered with no pdo_mysql, no routing assumptions and no three-second timeout. 017 covers the resume half and never landed with #214.

Scheduler. zend_fiber_switch_context now clears the window before the jump, so a coroutine's fiber starts outside any of them whichever way it is entered. The reset in fiber_entry was a second mechanism for one invariant, and neither was visibly load-bearing; it goes.

Verified by removing each half in turn: with the engine change and without the fiber_entry reset, 016 and 017 both pass; with neither, both fail.

EdmondDantes and others added 2 commits July 31, 2026 21:40
016 held the window open with a PDO connect to an unroutable address and gave
the victim 50 ms to run inside it. If the network answered quickly the window
was already closed by then and the test passed without exercising anything —
green either way, which is the one thing a regression test must not be.

A userland stream wrapper under DirectoryIterator reaches the same window and
parks inside it on a timer we control, so both halves are covered with no
pdo_mysql, no routing assumptions and no three-second timeout. 017 covers the
resume half and never landed with #214.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
zend_fiber_switch_context clears EG(error_handling)/EG(exception_class) before
the jump, so a coroutine's fiber starts outside any EH_THROW window whichever
way it is entered. A second reset here left two mechanisms for one invariant,
and neither of them visibly load-bearing.

Requires php-src true-async-stable bfb4525597; edge_cases 016 fails without it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@EdmondDantes EdmondDantes changed the title test: reach the EH_THROW window without a database EH_THROW window: one mechanism, and tests that need no database Jul 31, 2026
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@EdmondDantes
EdmondDantes merged commit 1118dd0 into main Jul 31, 2026
9 checks passed
@EdmondDantes
EdmondDantes deleted the tests/eh-window-without-a-database branch July 31, 2026 22:11
EdmondDantes added a commit that referenced this pull request Jul 31, 2026
…abase

EH_THROW window: one mechanism, and tests that need no database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant