feat(libSceHttp2): complete asynchronous requests through the kqueue option #1092

Merged
kjhq merged 1 commit from upstream-pr/1092 into main 2026-10-08 05:18:26 +00:00
kjhq commented 2026-10-07 10:39:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kjhq on 2026-10-07T10:39:17Z.


What

No network is emulated, so every libSceHttp2 request fails with the library's network error (0x80436063). Until now sceHttp2SendRequestAsync returned that error synchronously and sceHttp2WaitAsync returned it too. Titles that use the asynchronous API expect the failure to arrive as a completion instead:

  • sceHttp2SendRequestAsync takes the kqueue option (new Http2AsyncOption in SceTypes.hpp: equeue at 0, user event id at 8, user data at 16; layout inferred from PPSA17221), queues an Http2AsyncResult for the request with result = network error, triggers the user event on that equeue with the user data, and returns 0.
  • sceHttp2WaitAsync returns and removes the oldest completion of the request. sceHttp2DeleteRequest drops pending completions.
  • A missing kqueue option, a non-null extra option, a user event that is not registered, and a wait with no completed operation throw (NotImplemented_nid_no_patch).
  • TechnicalDebt (Functional) describes this, including that the completion's event_type value is unknown and left 0.

PPSA17221 (Minecraft) completes its request object only after sceHttp2SendRequestAsync returns, and its handler for a synchronous failure calls shared_from_this before that, so a synchronous failure crashed it.

guest_http2 now registers a user event, sends asynchronously, receives the event with the request id and user data, reads the completion with sceHttp2WaitAsync, and checks the throwing cases.

Title

PPSA17221 (Minecraft) needs #716 to load the modules in its app root, so every run below is current main + #716 + the PRs of this set (#1088, #1090–#1096), plus local changes outside it: dialog, NpAuth and TextToSpeech2 stubs that open PRs cover (#560, #925, #301) and a GPU end-of-pipe change that is not submitted. With all of them the title loads a world. The line below is from a run with only this PR left out, Windows 11, WinLibs GCC, normal user session.

Without it the title terminates about 8 s after start:

Terminating due to uncaught exception 'bad_weak_ptr' of type std::bad_weak_ptr
FATAL: unhandled exception 0xc000001d on thread 18280 'REST Thread(0)'

Tested

Debian 13 (WSL2), GCC 14.2.0, Release: full ctest 390/390 passed (GPU tests skipped: no Vulkan device in WSL), including guest_http2.

Windows 11, WinLibs GCC: PPSA17221 with this PR and the rest of the set loads a world (runs described above). Not tested with Windows ctest.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4771426753 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1092). Originally posted by [kjhq](https://github.com/kjhq) on 2026-10-07T10:39:17Z. --- ### What No network is emulated, so every libSceHttp2 request fails with the library's network error (0x80436063). Until now `sceHttp2SendRequestAsync` returned that error synchronously and `sceHttp2WaitAsync` returned it too. Titles that use the asynchronous API expect the failure to arrive as a completion instead: - `sceHttp2SendRequestAsync` takes the kqueue option (new `Http2AsyncOption` in `SceTypes.hpp`: equeue at 0, user event id at 8, user data at 16; layout inferred from PPSA17221), queues an `Http2AsyncResult` for the request with `result` = network error, triggers the user event on that equeue with the user data, and returns 0. - `sceHttp2WaitAsync` returns and removes the oldest completion of the request. `sceHttp2DeleteRequest` drops pending completions. - A missing kqueue option, a non-null extra option, a user event that is not registered, and a wait with no completed operation throw (`NotImplemented_nid_no_patch`). - TechnicalDebt (Functional) describes this, including that the completion's `event_type` value is unknown and left 0. PPSA17221 (Minecraft) completes its request object only after `sceHttp2SendRequestAsync` returns, and its handler for a synchronous failure calls `shared_from_this` before that, so a synchronous failure crashed it. `guest_http2` now registers a user event, sends asynchronously, receives the event with the request id and user data, reads the completion with `sceHttp2WaitAsync`, and checks the throwing cases. ### Title PPSA17221 (Minecraft) needs #716 to load the modules in its app root, so every run below is current `main` + #716 + the PRs of this set (#1088, #1090–#1096), plus local changes outside it: dialog, NpAuth and TextToSpeech2 stubs that open PRs cover (#560, #925, #301) and a GPU end-of-pipe change that is not submitted. With all of them the title loads a world. The line below is from a run with only this PR left out, Windows 11, WinLibs GCC, normal user session. Without it the title terminates about 8 s after start: ``` Terminating due to uncaught exception 'bad_weak_ptr' of type std::bad_weak_ptr FATAL: unhandled exception 0xc000001d on thread 18280 'REST Thread(0)' ``` ### Tested Debian 13 (WSL2), GCC 14.2.0, Release: full `ctest` 390/390 passed (GPU tests skipped: no Vulkan device in WSL), including `guest_http2`. Windows 11, WinLibs GCC: PPSA17221 with this PR and the rest of the set loads a world (runs described above). Not tested with Windows `ctest`. ### Checklist - [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 - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [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] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-07 13:54:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T13:54:08Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#1116 docs/dev/TechnicalDebt.md L211
#1119 core/libs/prx/libSceHttp2/Export.cpp L4-5, L10
#1126 docs/dev/TechnicalDebt.md L211
#1128 sceHttp2SendRequestAsync
#1184 docs/dev/TechnicalDebt.md L211
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6039458969 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1092#issuecomment-6039458969). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T13:54:08Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #1116 | `docs/dev/TechnicalDebt.md` [L211](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/docs/dev/TechnicalDebt.md#L211) | | | | #1119 | `core/libs/prx/libSceHttp2/Export.cpp` [L4-5](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/core/libs/prx/libSceHttp2/Export.cpp#L4-L5), [L10](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/core/libs/prx/libSceHttp2/Export.cpp#L10) | | | | #1126 | `docs/dev/TechnicalDebt.md` [L211](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/docs/dev/TechnicalDebt.md#L211) | | | | #1128 | | `sceHttp2SendRequestAsync` | | | #1184 | `docs/dev/TechnicalDebt.md` [L211](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/docs/dev/TechnicalDebt.md#L211) | | |
github-actions[bot] commented 2026-10-08 04:37:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T04:37:59Z.


Progress report (0d3c1ee → 1cc4d25)

📉 System libraries: 86.54% (-0.07%, -2 reverted functions)

⚠️ 2 went back to stubs
Library Name
libSceHttp2 sceHttp2SendRequestAsync
libSceHttp2 sceHttp2WaitAsync
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6052358546 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1092#issuecomment-6052358546). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T04:37:59Z. --- <!-- progress-report --> ### Progress report (0d3c1ee → 1cc4d25) 📉 **System libraries**: 86.54% (-0.07%, -2 reverted functions) <details> <summary>⚠️ 2 went back to stubs</summary> | Library | Name | | - | - | | libSceHttp2 | `sceHttp2SendRequestAsync` | | libSceHttp2 | `sceHttp2WaitAsync` | </details>
samimalokozay7009-rgb commented 2026-10-17 14:15:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by samimalokozay7009-rgb on 2026-10-17T14:15:05Z.

Review: COMMENTED


Khan

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5558179042 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1092#pullrequestreview-5558179042). Originally posted by [samimalokozay7009-rgb](https://github.com/samimalokozay7009-rgb) on 2026-10-17T14:15:05Z. **Review:** COMMENTED --- Khan
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!1092
No description provided.