Repository navigation
test(http2): guard allocation-free handle teardown - #9598
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
The teardown now erases descendants and queued completions while holding the existing handle-then-completion lock order, without allocating temporary vectors. I checked that submission uses the same lock order and WaitAsync takes only the completion lock; the new fault-injection and submission/deletion tests cover the main ownership paths. The PR report is unusually clear about synthetic scope, actual executed counts, the temporary #8310 build overlay, and unverified console/event behavior. The intervening commits since tested base d9c99c9 are documentation-only, so they do not affect this implementation or the reported focused tests. Hosted conventions, eligibility, intake, labels and report checks pass; hosted product/relinker jobs are skipped. The Windows build/tests are author-reported, with an independent test comment also present. I did not run tests locally.
jotitadev
left a comment
There was a problem hiding this comment.
Linux run, since the description lists only Windows 11. The fix passes, but on Linux the test cannot show its red: with the base Export.cpp it hangs until the 30 s ctest timeout instead of printing the failure counts.
Machine: Linux x86_64, i7-8700, Ubuntu 26.04 (kernel 7.0.0-38), GCC 15.2, Release, BUILD_TESTING=ON. Head fdd048978 merged --no-commit onto main ab347d144 (clean).
-
With the PR:
guest_http2_teardownandguest_http2pass, 3 of 3 runs. -
Base
Export.cppplus this test:guest_http2_teardownis***Timeout 30.04 sec, with no output. The process is single-threaded and parked in a futex. Backtrace (gdb, first lifecycle,DeleteRequestat budget 0):#1 pthread_mutex_lock #2 LibcUnwind::FindFrameFast(LibcUnwind::Lookup&) libc.prx ... #6 _Unwind_RaiseException_nid_postfix libc.prx #7 __cxa_throw_nid_postfix libc.prx #8 operator new(unsigned long) [clone .cold] test #9 LibcUnwind::FindFrameFast(LibcUnwind::Lookup&) libc.prx ... #14 __cxa_throw_nid_postfix libc.prx #15 operator new(unsigned long) [clone .cold] test #16 sceHttp2DeleteRequest #17 mainOn this build the test executable's throw goes through
libc.prx's unwinder.FindFrameFastallocates while it holds its lock, the replacedoperator newis still at budget 0 and throws again, and the nested throw blocks on the same lock. So any regression that allocates in teardown shows up on Linux as a timeout, not as thethrew=… ownership=…lines. -
Disarming the budget before the throw fixes that here:
if (allocationBudget == 0) { allocationBudget = -1; throw std::bad_alloc(); }
With that change, base
Export.cppprints48 failures(23 withthrew=1), which matches the 23bad_allocin your table. With the PR it prints0 failures(3 of 3 runs). The PR's own result doesn't change, because the fixed teardown never allocates under the budget.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
jotitadev
left a comment
There was a problem hiding this comment.
Re-ran on Linux after 99d261595 (budget disarmed before the throw).
Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release. Head 58e6b6b56 merged --no-commit onto main d6eafa54d (clean).
- With the PR:
guest_http2_teardownprints48 allocation-pressure lifecycles, 192 concurrent lifecycles, 0 failures, 3 of 3 runs.guest_http,guest_http2,guest_http_optionsandguest_http_response_headeralso pass. - Base
Export.cppplus this test: no more timeout. It exits 1 in 0.02 s with48 failures, 23 of themthrew=1, which matches the Windows table.
So the red is now visible on Linux as well.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Rechecked the current head after the independent Linux follow-up: the approval still stands, and exact-head conventions plus whitespace checks pass. The Linux reviewer now reports 3/3 green runs and a visible 48-failure base control after the injector disarms before throwing. #6044 changes the broad CMake test naming/registration scheme but does not touch the HTTP2 implementation; please resolve/rebase the test-registration overlap and rerun registration/build checks after its merge if needed. |
MarcZX10
left a comment
There was a problem hiding this comment.
The failure-atomic teardown fix still has strong Windows evidence and an independent Linux red/green run after the allocator injector was made unwinding-safe. Exact head 58e6b6b5653d888955b39924beaf17f1f1a4dc0f passes current-main whitespace and conventions checks; the current-main merge tree is clean. I also syntax-compiled Export.cpp and Http2TeardownFailure.cpp with GCC 12.2 (suppressing existing unused-parameter/missing-field warnings in Export.cpp). I did not run the runtime tests locally.
The branch is based on b27924d851696cafcb83152515f1c84d8804e1f3, behind current main 3ca07d086d5f44fbe3c00370e7f03953ab46ca1b. Please update to current main and refresh focused tests, conventions, and registration checks. #6044 remains open and its test reorganization overlaps the broad CMake changes; the direct merge reports no conflict in this PR's libSceHttp2/CMakeLists.txt, but please preserve the guest_http2_teardown registration and rerun its build/registration checks after either branch is rebased. This request is only for the current-main and test-registration update; the code approval stands and the obsolete intake hold is withdrawn.
|
Independent verification of the outstanding ask (current-main refresh + refreshed focused rerun) as a combined both-stacks run — I ran the integration the comments above requested coordination on, on a local merge of both this stack and #9630's (their diffs are disjoint: Heads
Results (same machine, same build, parent vs change)Arch Linux (CachyOS, kernel 7.2.10-1-cachyos), GCC, Ninja,
Base: 7 of 8 fail, 3 consecutive runs identical. Change: 8/8 pass, 3 consecutive runs each in Release and ASan (12 runs total), each run reports 100% and no ASan report. In the base runs this PR's teardown failure is the deletion/erase path under allocation pressure (the log's Conventions: Not run: Windows, macOS, a title, console. The combined-stack caveat from the discussion above still stands: this establishes the teardown fix works together with #9630's on local Linux/ASan bookkeeping behavior, not console child-handle lifetimes or cancellation of already-posted events (recorded in this PR's debt). |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
c730b04 to
7a0dfeb
Compare
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Rechecked the rebased head: production |
What
Keep regression coverage for allocation-free HTTP2 handle teardown on the current transport backend. Main's synchronous transport implementation already replaced the temporary-vector cleanup and removed the old offline completion queue, so this rebased PR changes only the test and its CMake registration. Production
Export.cppis byte-identical to the base.The fixture calls the canonical public header and compiles the current production
Export.cppandCookies.cppwith the real transport dependency, allowing its replacement C++ allocator to observe teardown allocations. It checks request, template and context deletion under budgets 0–15: descendants disappear, neighboring templates and independent contexts survive, cookie boxes retain their separate ownership, and deletion makes no allocation attempt. The one-shot fault disarms before throwing so exception unwinding can allocate.The 192 concurrent cases now race child creation against deletion and check that no created handle escapes its parent's teardown. The removed async completion model is not restored. The new fixture covers unsent handles; existing HTTP2 transport fixtures remain registered and are included in the validation selection.
Tested
Base
ea048ce2c35e1fb65ea3331ed73bba35cb27e584; tested head7a0dfeb79c3d440738cf87762eafe07c96ceb1cf. Windows 11 Pro 10.0.26300, Ryzen 9 7900X, 31.7 GiB RAM, RTX 4070 Ti SUPER; WinLibs MinGW-w64 GCC 15.2.0 r7 UCRT, CMake 4.3.1, Ninja 1.13.2, Release,BUILD_TESTING=ON, pinned bundled dependencies. CPU and local socket fixtures.libs,patched_libraries_tests,guest_http2_tests,guest_http2_cookie_tests,guest_http2_transport_tests,guest_http2_teardown_tests,guest_http_tests,guest_http_response_header_tests,guest_http_options_tests,guest_ssl_tests,guest_ssl_load_tests,guest_ssl_transport_tests,guest_ssl_ps5_readers_testsandguest_sce_net_testswithcmake --build <build> --target <targets> --parallel 8.ctest --test-dir <build> -R '^(guest_http2.*|guest_http(_response_header|_options)?|guest_ssl(_load|_transport_kernel|_transport_net|_ps5_readers)?|guest_sce_net|patched_libraries)$' -V --output-on-failure --no-tests=error --repeat until-fail:3: 16/16 passed in all three repetitions, zero skips, 19.56 s total, outside the sandbox so the local socket fixtures can run. Each library-load check loaded 368 patched libraries, zero failures.Export.cppbyte-for-byte, rebuilt, and reran the complete green selection. This is a deliberate mutation, not a claim that current main still contains the original bug.ctest --test-dir <build> -R '^public_headers($|_compile_)' -j 4 --output-on-failure --no-tests=error: 65/65 passed, zero skips.tools/pr_overlap.pycompleted. Its test(http2): guard allocation-free handle teardown #9598 entries refer to this existing PR under its old branch head. test: organize library tests and label CTest suites #6044 is closed. The remaining uncomparable feat(libSceHttp2): create WebSocket requests and answer them as a PS5 does before they connect #11470 CMake edit addslibSceHttpto the production library's link dependencies, separately from this PR's new test target; I inspected that edit manually.No full CTest suite, title or console run is claimed. Earlier offline-completion measurements and Linux reports apply to the old implementation and are not evidence for this rewritten fixture.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)