feat(libSceHttp): report a context's pool in sceHttpGetMemoryPoolStats #8357
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8357"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarrasFederico on 2026-10-20T10:58:45Z.
What
sceHttpGetMemoryPoolStatsthrewnot implemented, and its debt entry listed the signature as unknown. SharpProsperoHttp.csdocuments it asint sceHttpGetMemoryPoolStats(int httpCtxId, SceHttpMemoryPoolStats* currentStat), which reads a context's pool use. The struct holds the pool size, the peak and current use, and a 32-bit reserved word.mainhas since declared the struct as those three 64-bit fields (24 bytes) infix(http): recover request metadata and memory stats signatures, so only those 24 bytes are written and the reserved word is left to the caller.sceHttpInitnow keeps the pool size it is given for each context, andsceHttpTermdrops it. The call:{pool size given to sceHttpInit, 0, 0}and returns 0. The library takes nothing from the guest pool, so both use figures are 0; Http2 and NpWebApi2 already report their pools this way.ERROR_BEFORE_INIT(0x80431001) without writing.ERROR_INVALID_ID(0x80431100) without writing. Both errors and their order followsceHttpCookieFlush.currentStat: throws, as the console's error for it is unknown. It is checked first, as Http2 does.The debt entry records that nothing here is measured on a console and that a console already uses part of the pool for a live context.
Tested
Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with
BUILD_TESTING=ON. Windows was not compiled. No title was run.guest_http:sceHttpInit, ids 0, -1 and a request id returnERROR_BEFORE_INIT.INT32_MAXand a request id returnERROR_INVALID_ID. Two live contexts report their own pool sizes (0x10000 and 0x23000), and a pool above 32 bits (0x123456000) and a pool of 0 are reported unchanged.ERROR_INVALID_IDwhile the other is unaffected, andERROR_BEFORE_INITcomes back after the lastsceHttpTerm.main, where the call throws. Storing a constant pool size, not dropping it onsceHttpTerm, or skipping theERROR_BEFORE_INITcheck makes it fail.httppass.main524398151f. The branch adoptsmain's declaration and 24-byte struct. The test now checks that nothing past those 24 bytes is written; writing a reserved word after them makes it fail. All 4guest_httptests pass.tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pyfinds no conflicting lines. It could not compare #6044 (test reorganization), which conflicts withmain. The branch also merges cleanly with #8245, which reworks the HTTP options in the same file.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T10:59:27Z.
Progress report (
8b3e398→73822f3)📈 System libraries: 43.24% (+0.01%, +1 implemented functions)
✅ 1 implemented
sceHttpGetMemoryPoolStatsImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T23:33:07Z.
Independent Windows run of this PR (data only).
Environment: Windows 10 Pro 10.0.19045, Ryzen 7 5800X3D, WinLibs GCC 15.2.0 r7 (MinGW-w64 UCRT), Release, BUILD_TESTING=ON. Merge-tree of the PR head against
main339217ebc9is clean. I built onlyguest_http_tests;ctest -N -R guest_httplists exactly one test.Results (3 runs each):
guest_httppasses 3/3.core/libs/prx/libSceHttp/Export.cppwith the version from the PR's merge base (777bd0f4b2), then rebuilt. The test fails 3/3 (exit 0xc0000409, a failedRequire). I restored the PR'sExport.cppafterwards.Not run: other platforms, the other Http tests, the full repository CTest, and any title or console run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T05:12:09Z.
I opened #9630 to fix allocation-failure ownership in HTTP initialization, epoll creation and final-context teardown. Your pool-size registry also adds work to initialization and termination. I propose merging #9630 first, then rebasing this PR and retaining rollback across every context registry. #9630 has no dependency on the pool-stat implementation.
Imported from boykopovar/AnyPS5. Originally posted by MarrasFederico on 2026-10-22T08:28:40Z.
@Ondra97 agreed: #9630 first, then I'll rebase this PR onto it.
You're right about the registry. This PR inserts the pool size before
g_contexts.insert, so a later allocation failure insceHttpInitwould leave a stale entry. When I rebase, the pool-size insertion will move inside your rollback: on failure it is erased together with the context and its options.sceHttpTermkeeps erasing it with the context.I'll note the dependency here once #9630 is merged.