Skip to content

feat(libSceHttp): implement abortable epoll waits - #3706

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
MarcZX10:codex/http-abort-wait-3156
Oct 11, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
MarcZX10:codex/http-abort-wait-3156

Conversation

@MarcZX10

Copy link
Copy Markdown
Contributor

What

Carries David's ready implementation from issue #3156, preserving his authorship. Adds sceHttpAbortWaitRequest and allows sceHttpWaitRequest to wait without a timeout until the epoll is aborted, destroyed, or the last HTTP context ends.

The implementation follows shadPS4 for the assumed error codes and lifecycle behavior; these details are not confirmed on PS5 hardware. The timeout is treated as microseconds, and a wait returns zero events because requests do not reach the network. The epoll retains shared ownership while waiters run.

The Windows wait uses the native SRW lock and condition variable to avoid the scheduler-tick overshoot measured on Windows in the issue discussion. The timing observation and approach were contributed by @winstrex and are credited in the follow-up commit.

Tested

  • Linux, GCC 12.2, Release: built guest_http_tests; CTest guest_http passed 3 consecutive runs.
  • python3 tools/check_conventions.py --base upstream/main --head 776cff0ef and git diff --check upstream/main...HEAD passed.
  • David reports Windows 11 / MinGW GCC 15.2 Release tests for the original ready implementation. @winstrex reports Windows measurements and tests for the native wait approach in the issue discussion. I have not independently built this updated branch on Windows or run a title.

Checklist

  • Based on current main; no other open PR implements these 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
  • No new third-party source is added
  • Generic behavior, not specific to one title
  • Depends on: none
  • AI-assisted: yes

David and others added 2 commits October 11, 2026 15:40
… sceHttpWaitRequest

Deathloop (PPSA01670) imports sceHttpAbortWaitRequest; Planet Coaster
(PPSA01736) and Palworld import sceHttpWaitRequest.

Epoll handles are kept in a registry with an abort flag, a destroyed flag
and a condition variable. A wait with a negative timeout blocks until
sceHttpAbortWaitRequest, sceHttpDestroyEpoll or the sceHttpTerm of the
last context wakes it; a bounded wait still returns 0 events. An abort
stays set and makes every later wait return SCE_HTTP_ERROR_ABORTED
(0x80431080); a wait woken by destroy or term returns 0 events.
sceHttpDestroyEpoll no longer frees a handle a waiter is blocked on.
sceHttpInit registers its context, and the epoll calls and sceHttpTerm
return BEFORE_INIT without a live context and INVALID_ID for an unknown
context or handle.

Behaviour and error codes: shadPS4 src/core/libraries/network/http.cpp
and http_error.h at a8a70da595da2a96e0410309472ba4a7eb558144.
Signature (void* eh): Orbital tools/ida/db_types.json at
b321fcdbd700cc02da1cb1ad25412781d5ec73c6 and SharpProspero
src/SharpProspero/Interop/Net/Http.cs at
60977b29103452b9681ae10c7a9011d44965bf16.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 766997d)
Use an SRW lock and native Windows condition variable for epoll waits, preserving the shared handle lifecycle. This avoids the scheduler-tick overshoot measured with std::condition_variable on Windows.

Suggested-by: winstrex
@github-actions

Copy link
Copy Markdown

Progress report (a11c8f7 → 776cff0)

📈 System libraries: 85.87% (+0.06%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceHttp sceHttpAbortWaitRequest
libSceHttp sceHttpWaitRequest

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked build + ctest (guest_http) on Linux, the new test fails without the change, error codes match KytyPS5 and the behaviour (sticky abort, wake on destroy/term) follows shadPS4 as documented in TechnicalDebt; merging.

@adriadam10
adriadam10 merged commit 1be2ca2 into boykopovar:main Oct 11, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants