fix(libSceHttp2): report a live context's pool size from sceHttp2GetMemoryPoolStats #11616

Merged
milescoviello merged 2 commits from upstream-pr/11616 into main 2026-10-28 14:17:09 +00:00
milescoviello commented 2026-10-26 22:56:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-26T22:56:04Z.


What

MXGP 26 (PPSA30839) stops 13 s after launch on current main:

what():  sceHttp2GetMemoryPoolStats not implemented

#10167 made sceHttp2GetMemoryPoolStats throw for a live context, because its HTTP allocations are not charged to the context pool. Before that it returned the pool size with zero use. MXGP calls it from Unreal Engine's network memory logging, next to sceSslGetMemoryPoolStats and sceNetGetMemoryPoolStats. It reads pool_size, max_inuse_size and current_inuse_size into its own counters and never checks the result. With the throw, it aborts before its first menu. Borderlands 4 (PPSA01494) and Super Meat Boy 3D (PPSA31162) make the same call next to the same two calls; I have not run them on this change.

For a live context, sceHttp2GetMemoryPoolStats now reports the pool size given to sceHttp2Init and zero peak and current use, as sceHttpGetMemoryPoolStats does for libSceHttp. The existing libSceNet entry records what the console reports for a fresh context, 0x1640 bytes in use. Null output and unknown or terminated ids return the same errors as before.

Call sites (call to the import's PLT stub; the 25 bytes ending at each call's opcode occur once in the title's eboot.bin):

Title Version Address in eboot.bin
Borderlands 4 (PPSA01494) 01.100.002 0x218C4AA
MXGP 26 (PPSA30839) 01.003.000 0x139F2DC
Super Meat Boy 3D (PPSA31162) 02.000.001 0x140DD27, 0x140F448

How

  • Export.cpp: sceHttp2GetMemoryPoolStats writes {poolSize, 0, 0, 0} from the context handle instead of throwing.
  • GuestHttp2.cpp and GuestMemoryPoolStats.cpp checked for the throw. They now seed the output with nonzero values and require the init pool size (0x10000 and 0x40000) with zero peak, current use and reserved field.
  • docs/dev/debt/libSceHttp2.md: the TLS-settings entry's last sentence now says what is reported and names the three titles.

Overlap. #10536 and #11611 rewrite other parts of that same debt line and keep its old last sentence, so whichever lands second has a one-line conflict: keep their text and this PR's last sentence. Their code hunks apply cleanly on this branch (git apply --check). #11470 already conflicts with main. A follow-up for sceHttp2SetResolveRetry, the next call these titles make, is stacked on this branch.

Tested

Linux (Ubuntu 26.04.1, GCC 15.2), Release.

  • Focused tests: the 48 tests matching #10167's selection, ^(guest_http2(_.*)?|guest_ssl(_.*)?|guest_net_.*|net_.*|guest_sce_net(_.*)?|guest_memory_pool_stats|guest_http(_response_header|_options)?|patched_libraries|public_headers)$, pass 3 of 3 (ctest --repeat until-fail:3).
  • Red control: the two updated tests on this branch with main's Export.cpp both abort with sceHttp2GetMemoryPoolStats not implemented.
  • MXGP 26: release libs, 600 s, controller input through APS5_PAD_INPUT_FILE. On main 74acfad65b it exits at 13 s with the error above. On this branch the stats call passes, and it exits at 8 s on the next call, sceHttp2SetResolveRetry not implemented, which the follow-up covers.
  • Windows 11 VM (GT 1030, WinLibs GCC 15.2.0): guest_http2, guest_http2_transport and guest_memory_pool_stats pass 3 of 3 on both main 74acfad65b and this head.
  • tools/check_conventions.py --base upstream/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA30839 past its sceHttp2GetMemoryPoolStats stop (PPSA01494 and PPSA31162 make the same call, not run)
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5025884343 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11616). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-26T22:56:04Z. --- ### What MXGP 26 (PPSA30839) stops 13 s after launch on current `main`: ```text what(): sceHttp2GetMemoryPoolStats not implemented ``` #10167 made `sceHttp2GetMemoryPoolStats` throw for a live context, because its HTTP allocations are not charged to the context pool. Before that it returned the pool size with zero use. MXGP calls it from Unreal Engine's network memory logging, next to `sceSslGetMemoryPoolStats` and `sceNetGetMemoryPoolStats`. It reads `pool_size`, `max_inuse_size` and `current_inuse_size` into its own counters and never checks the result. With the throw, it aborts before its first menu. Borderlands 4 (PPSA01494) and Super Meat Boy 3D (PPSA31162) make the same call next to the same two calls; I have not run them on this change. For a live context, `sceHttp2GetMemoryPoolStats` now reports the pool size given to `sceHttp2Init` and zero peak and current use, as `sceHttpGetMemoryPoolStats` does for libSceHttp. The existing libSceNet entry records what the console reports for a fresh context, 0x1640 bytes in use. Null output and unknown or terminated ids return the same errors as before. Call sites (`call` to the import's PLT stub; the 25 bytes ending at each call's opcode occur once in the title's `eboot.bin`): | Title | Version | Address in `eboot.bin` | |---|---|---| | Borderlands 4 (PPSA01494) | 01.100.002 | 0x218C4AA | | MXGP 26 (PPSA30839) | 01.003.000 | 0x139F2DC | | Super Meat Boy 3D (PPSA31162) | 02.000.001 | 0x140DD27, 0x140F448 | ### How - `Export.cpp`: `sceHttp2GetMemoryPoolStats` writes `{poolSize, 0, 0, 0}` from the context handle instead of throwing. - `GuestHttp2.cpp` and `GuestMemoryPoolStats.cpp` checked for the throw. They now seed the output with nonzero values and require the init pool size (0x10000 and 0x40000) with zero peak, current use and reserved field. - `docs/dev/debt/libSceHttp2.md`: the TLS-settings entry's last sentence now says what is reported and names the three titles. **Overlap.** #10536 and #11611 rewrite other parts of that same debt line and keep its old last sentence, so whichever lands second has a one-line conflict: keep their text and this PR's last sentence. Their code hunks apply cleanly on this branch (`git apply --check`). #11470 already conflicts with `main`. A follow-up for `sceHttp2SetResolveRetry`, the next call these titles make, is stacked on this branch. ### Tested Linux (Ubuntu 26.04.1, GCC 15.2), Release. - **Focused tests:** the 48 tests matching #10167's selection, `^(guest_http2(_.*)?|guest_ssl(_.*)?|guest_net_.*|net_.*|guest_sce_net(_.*)?|guest_memory_pool_stats|guest_http(_response_header|_options)?|patched_libraries|public_headers)$`, pass 3 of 3 (`ctest --repeat until-fail:3`). - **Red control:** the two updated tests on this branch with `main`'s `Export.cpp` both abort with `sceHttp2GetMemoryPoolStats not implemented`. - **MXGP 26:** release libs, 600 s, controller input through `APS5_PAD_INPUT_FILE`. On `main` 74acfad65b it exits at 13 s with the error above. On this branch the stats call passes, and it exits at 8 s on the next call, `sceHttp2SetResolveRetry not implemented`, which the follow-up covers. - **Windows 11 VM** (GT 1030, WinLibs GCC 15.2.0): `guest_http2`, `guest_http2_transport` and `guest_memory_pool_stats` pass 3 of 3 on both `main` 74acfad65b and this head. - `tools/check_conventions.py --base upstream/main` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA30839 past its `sceHttp2GetMemoryPoolStats` stop (PPSA01494 and PPSA31162 make the same call, not run) - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-26 23:00:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T23:00:24Z.

Review: APPROVED


Reviewed exact head 04db088075749cb3c13b50bc64875cfc8981e313; no actionable findings. The live-context path reports the stored init pool size and zero use/peak/reserved fields, consistent with this implementation not charging its host allocations to the guest HTTP pool. Null output and invalid-id handling are unchanged; tests seed all output fields and check the returned values. I manually checked the declared overlap with #10536 and #11611: their debt-line edits are distinct prose that must be preserved together; the Export.cpp behavior change is localized to the stats function. The author reports the focused 48-test selection passing three times and a title startup progressing past this call; I did not rerun locally. Hosted eligibility, conventions, intake, labels and report checks pass; build/relinker/product checks are skipped by path policy.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5660231609 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11616#pullrequestreview-5660231609). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T23:00:24Z. **Review:** APPROVED --- Reviewed exact head `04db088075749cb3c13b50bc64875cfc8981e313`; no actionable findings. The live-context path reports the stored init pool size and zero use/peak/reserved fields, consistent with this implementation not charging its host allocations to the guest HTTP pool. Null output and invalid-id handling are unchanged; tests seed all output fields and check the returned values. I manually checked the declared overlap with #10536 and #11611: their debt-line edits are distinct prose that must be preserved together; the Export.cpp behavior change is localized to the stats function. The author reports the focused 48-test selection passing three times and a title startup progressing past this call; I did not rerun locally. Hosted eligibility, conventions, intake, labels and report checks pass; build/relinker/product checks are skipped by path policy.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!11616
No description provided.