feat(net): implement synchronous resolver abort state #2281

Closed
joelfernandes23 wants to merge 2 commits from upstream-pr/2281 into main
joelfernandes23 commented 2026-10-09 14:29:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by joelfernandes23 on 2026-10-09T14:29:41Z.


What

sceNetResolverAbort currently throws. Give it the (resolver ID, flags) signature and implement abort state for the existing synchronous resolvers. An idle abort can preserve one cancellation independently for the next NTOA or ATON lookup. An active abort records EINTR and prevents that lookup from publishing its output or clearing its interrupted error state.

Resolver destruction also suppresses late output. Host lookups use temporary output storage, and completion checks cancellation under the same lock that protects result delivery. A second simultaneous lookup on the same resolver returns resolver EBUSY, including after abort while the cancelled host call is still running. Reuse becomes available only once that call completes. Unknown abort bits and unsupported nonzero start flags throw.

Limitation: this does not interrupt host getaddrinfo or getnameinfo. The cancelled synchronous caller returns only after the host call finishes. Timeout/retry remain unimplemented; no asynchronous resolver or epoll support is added.

The signature, preservation bits, active-abort status and busy code follow shadPS4 net.cpp, net_resolver.cpp, and its net types/error definitions. These are PS4 reimplementation references, not PS5 measurements. The in-flight-destroy EBADF return and remaining uncertainties are recorded in TechnicalDebt.

Checked open PRs for resolver work and the exact export before starting. #2195 implements sceNetResolverStartNtoaMultipleRecords, which this change leaves unimplemented; both branches touch the existing network test and export file, so they may need textual reconciliation. No dependency on that PR.

Tested

Windows 11 Pro 10.0.26200, Ryzen 7 7700X, RX 7900 XT, AMD driver 32.0.31041.1004. WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7, Release, BUILD_TESTING=ON, SPIRV-Tools OFF. Main d70b89989473ba1f6ae13e44e079e67f1f8a44b0; local implementation commit b762bcb0b2d40577552c14b78f622467682f20ce.

  • Extended guest_sce_net checks the actual exports: invalid/destroyed IDs, idle abort, independent one-shot preservation, unchanged output on interruption, forward/reverse resolution, multi-record preservation, errno/error state, and rejected flags.
  • The extended export regression fails with unchanged main's Export.cpp (sceNetResolverAbort not implemented), then passes with the implementation.
  • New net_resolver_state uses controlled blocking work to verify active forward/reverse cancellation, resolver busy state, destruction, cancellation taking precedence over a late host error, rejected flags during a lookup, exception cleanup, busy rejection of both lookup kinds until cancelled host work finishes, and successful reuse after completion. These tests exercise the state implementation used by the exports without depending on DNS latency.
  • Both focused CTests passed 100/100 consecutive runs. Each finishes well below one second locally.
  • Full build and explicit libs target, including NID packaging, passed.
  • Full CTest on the final implementation: 505 passed, 2 failed, 1 skipped, 508 total, 27.97 seconds. The failures are the independently reproduced existing GPU clock-wrap (#1615) and comparison (#825) bugs; the skip is guest_video_out_wqhd_detection_no_vulkan.
  • Conventions, whitespace and test-registration checks passed.

Not tested on Linux, PS5 hardware or a title. Prompt host DNS cancellation is not claimed.

Checklist

  • Based on main; no duplicate open PR for this export found

  • One topic per PR

  • No code comments added

  • Unsupported paths throw; no silent stubs added

  • Investigation notes and logs remain outside the repository

  • No new third-party code

  • Generic behavior, not specific to one title

  • Depends on: none

  • AI-assisted: yes

The reviewed busy-state regression fails before the follow-up with aborted host lookup allowed Ntoa reuse before completion; it passes after retaining the active operation until host completion. Both lookup directions and repeated aborts are covered.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4801808120 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2281). Originally posted by [joelfernandes23](https://github.com/joelfernandes23) on 2026-10-09T14:29:41Z. --- ### What `sceNetResolverAbort` currently throws. Give it the `(resolver ID, flags)` signature and implement abort state for the existing synchronous resolvers. An idle abort can preserve one cancellation independently for the next NTOA or ATON lookup. An active abort records EINTR and prevents that lookup from publishing its output or clearing its interrupted error state. Resolver destruction also suppresses late output. Host lookups use temporary output storage, and completion checks cancellation under the same lock that protects result delivery. A second simultaneous lookup on the same resolver returns resolver EBUSY, including after abort while the cancelled host call is still running. Reuse becomes available only once that call completes. Unknown abort bits and unsupported nonzero start flags throw. **Limitation:** this does not interrupt host `getaddrinfo` or `getnameinfo`. The cancelled synchronous caller returns only after the host call finishes. Timeout/retry remain unimplemented; no asynchronous resolver or epoll support is added. The signature, preservation bits, active-abort status and busy code follow [shadPS4 net.cpp](https://github.com/shadps4-emu/shadPS4/blob/0c9ca525b8add53e62b3ccd9c9c2f6ef2ebabbfa/src/core/libraries/net/net.cpp), [net_resolver.cpp](https://github.com/shadps4-emu/shadPS4/blob/0c9ca525b8add53e62b3ccd9c9c2f6ef2ebabbfa/src/core/libraries/net/net_resolver.cpp), and its net types/error definitions. These are PS4 reimplementation references, not PS5 measurements. The in-flight-destroy EBADF return and remaining uncertainties are recorded in TechnicalDebt. Checked open PRs for resolver work and the exact export before starting. #2195 implements `sceNetResolverStartNtoaMultipleRecords`, which this change leaves unimplemented; both branches touch the existing network test and export file, so they may need textual reconciliation. No dependency on that PR. ### Tested Windows 11 Pro 10.0.26200, Ryzen 7 7700X, RX 7900 XT, AMD driver 32.0.31041.1004. WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7, Release, BUILD_TESTING=ON, SPIRV-Tools OFF. Main `d70b89989473ba1f6ae13e44e079e67f1f8a44b0`; local implementation commit `b762bcb0b2d40577552c14b78f622467682f20ce`. - Extended `guest_sce_net` checks the actual exports: invalid/destroyed IDs, idle abort, independent one-shot preservation, unchanged output on interruption, forward/reverse resolution, multi-record preservation, errno/error state, and rejected flags. - The extended export regression fails with unchanged main's Export.cpp (`sceNetResolverAbort not implemented`), then passes with the implementation. - New `net_resolver_state` uses controlled blocking work to verify active forward/reverse cancellation, resolver busy state, destruction, cancellation taking precedence over a late host error, rejected flags during a lookup, exception cleanup, busy rejection of both lookup kinds until cancelled host work finishes, and successful reuse after completion. These tests exercise the state implementation used by the exports without depending on DNS latency. - Both focused CTests passed 100/100 consecutive runs. Each finishes well below one second locally. - Full build and explicit libs target, including NID packaging, passed. - Full CTest on the final implementation: 505 passed, 2 failed, 1 skipped, 508 total, 27.97 seconds. The failures are the independently reproduced existing GPU clock-wrap (#1615) and comparison (#825) bugs; the skip is `guest_video_out_wqhd_detection_no_vulkan`. - Conventions, whitespace and test-registration checks passed. Not tested on Linux, PS5 hardware or a title. Prompt host DNS cancellation is not claimed. ### Checklist - [x] Based on main; no duplicate open PR for this export found - [x] One topic per PR - [x] No code comments added - [x] Unsupported paths throw; no silent stubs added - [x] Investigation notes and logs remain outside the repository - [x] No new third-party code - [x] Generic behavior, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes The reviewed busy-state regression fails before the follow-up with `aborted host lookup allowed Ntoa reuse before completion`; it passes after retaining the active operation until host completion. Both lookup directions and repeated aborts are covered.
MarcZX10 commented 2026-10-09 14:33:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T14:33:44Z.


Two follow-ups from the exact diff/checks:

  • The Conventions check fails because the PR description does not answer the required AI-assisted template question. Please add AI-assisted: yes or no and rerun it.
  • State::Abort clears active immediately, while the documented limitation says the host DNS call continues until completion. A new Run can therefore begin on the same resolver while the canceled host lookup is still running; CheckOldCompletionWhileReusedLookupRuns explicitly permits this. That conflicts with the PR description that a second simultaneous lookup returns resolver EBUSY. Please keep the resolver busy until the old host call returns, or cite evidence that the console allows reuse during an in-flight canceled synchronous lookup and make the stated contract/tests match.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6083030397 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2281#issuecomment-6083030397). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-09T14:33:44Z. --- Two follow-ups from the exact diff/checks: - The Conventions check fails because the PR description does not answer the required `AI-assisted` template question. Please add `AI-assisted: yes` or `no` and rerun it. - `State::Abort` clears `active` immediately, while the documented limitation says the host DNS call continues until completion. A new `Run` can therefore begin on the same resolver while the canceled host lookup is still running; `CheckOldCompletionWhileReusedLookupRuns` explicitly permits this. That conflicts with the PR description that a second simultaneous lookup returns resolver `EBUSY`. Please keep the resolver busy until the old host call returns, or cite evidence that the console allows reuse during an in-flight canceled synchronous lookup and make the stated contract/tests match.
github-actions[bot] commented 2026-10-09 14:34:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T14:34:54Z.


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
#2142 docs/dev/TechnicalDebt.md L367
#2161 docs/dev/TechnicalDebt.md L367
#2182 docs/dev/TechnicalDebt.md L367
#2185 core/libs/prx/libSceNet/CMakeLists.txt L11-12
#2195 core/libs/tests/GuestSceNet.cpp L83
#2308 docs/dev/TechnicalDebt.md L59
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6083050644 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2281#issuecomment-6083050644). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T14:34:54Z. --- <!-- 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 | |---|---|---|---| | #2142 | `docs/dev/TechnicalDebt.md` [L367](https://github.com/boykopovar/AnyPS5/blob/8b393b6e9a8ade9188d4f74a0293e0efd9828597/docs/dev/TechnicalDebt.md#L367) | | | | #2161 | `docs/dev/TechnicalDebt.md` [L367](https://github.com/boykopovar/AnyPS5/blob/8b393b6e9a8ade9188d4f74a0293e0efd9828597/docs/dev/TechnicalDebt.md#L367) | | | | #2182 | `docs/dev/TechnicalDebt.md` [L367](https://github.com/boykopovar/AnyPS5/blob/8b393b6e9a8ade9188d4f74a0293e0efd9828597/docs/dev/TechnicalDebt.md#L367) | | | | #2185 | `core/libs/prx/libSceNet/CMakeLists.txt` [L11-12](https://github.com/boykopovar/AnyPS5/blob/8b393b6e9a8ade9188d4f74a0293e0efd9828597/core/libs/prx/libSceNet/CMakeLists.txt#L11-L12) | | | | #2195 | `core/libs/tests/GuestSceNet.cpp` [L83](https://github.com/boykopovar/AnyPS5/blob/8b393b6e9a8ade9188d4f74a0293e0efd9828597/core/libs/tests/GuestSceNet.cpp#L83) | | | | #2308 | `docs/dev/TechnicalDebt.md` [L59](https://github.com/boykopovar/AnyPS5/blob/8b393b6e9a8ade9188d4f74a0293e0efd9828597/docs/dev/TechnicalDebt.md#L59) | | |
oneandonlydean commented 2026-10-09 20:11:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-09T20:11:20Z.


Closing: no title is shown calling sceNetResolverAbort on main, and library functions go in when one does. Please reopen with the title ID and the log line where it stops if you find one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6088461920 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2281#issuecomment-6088461920). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-09T20:11:20Z. --- Closing: no title is shown calling `sceNetResolverAbort` on main, and library functions go in when one does. Please reopen with the title ID and the log line where it stops if you find one.

Pull request closed

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!2281
No description provided.