Skip to content

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

Closed
joelfernandes23 wants to merge 2 commits into
boykopovar:mainfrom
joelfernandes23:feat/net-resolver-abort
Closed

joelfernandes23 wants to merge 2 commits into
boykopovar:mainfrom
joelfernandes23:feat/net-resolver-abort

Conversation

@joelfernandes23

@joelfernandes23 joelfernandes23 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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 (s_memtime goes backwards on AMD's Windows driver too: #1383's narrow-clock check only matches RADV #1615) and comparison (agc_driver_vopc_compare_table fails in wave32 for LG compares in the e32 encoding on AMD RDNA 3.5 #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.

@MarcZX10

MarcZX10 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

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.

3 participants