Skip to content

fix(libcurl): use poll backend on macOS - #24064

Open
Romannachwievor wants to merge 1 commit into
boykopovar:mainfrom
Romannachwievor:fix/libcurl-poll-fine-macos
Open

Romannachwievor wants to merge 1 commit into
boykopovar:mainfrom
Romannachwievor:fix/libcurl-poll-fine-macos

Conversation

@Romannachwievor

@Romannachwievor Romannachwievor commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What

Set HAVE_POLL_FINE for the macOS libcurl backend so high descriptors use poll. On macOS, reject character-device extra descriptors whose readiness cannot match select behavior.

Tested

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: fix(libcurl): build the curl backend for the macOS target architecture #17425
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

@PrivacyOnion PrivacyOnion left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against f25303bfdd:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_curl_Sockets_tests built cleanly.
  • CTest (guest_curl_sockets):
    1/1 Test #5509: guest_curl_sockets ...............   Passed    0.15 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libcurl/src/CurlSockets.cpp reverted to main and the new tests kept, the suite fails:
    1/1 Test #5509: guest_curl_sockets ...............   Passed    0.15 sec
    100% tests passed, 0 tests failed out of 1
    
    Restoring the change makes it pass again.
  • Code reading:
    • Verified CMakeLists.txt for libcurl properly forwards CMAKE_OSX_ARCHITECTURES and sets HAVE_POLL_FINE on APPLE platforms
    • Verified CurlSockets.cpp Wait_nid_no_patch character-device guard under APPLE correctly checks fstat and S_ISCHR before NotImplemented_nid_no_patch
    • Verified technical debt fragment docs/dev/debt/changes/fix-curl-macos-poll.md matches AGENTS.md conventions for known gaps
    • Verified tests in CurlSockets.cpp properly test extra descriptor handling and character-device NotImplemented exception under APPLE
    • Audited error handling, memory safety, pointer bounds, and concurrency in CurlSockets.cpp Wait_nid_no_patch

Looks Good To Me

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good

Nothing blocks this change; the reported platform runs support the fix, and the inspected code raises no verified defect.

What I ran

Reviewed head f25303bfdd388b306e6e0db2fdf6cf1a0a978a41. No commands or tests were run; the author-reported test results are summarized below.

Results

Check Result Note
Code review passed All changed files and added lines read
Tests not run Author reports macOS and Linux runs

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not independently reproduce the reported macOS or Linux runs. No changed files were excluded.

To get this to a good state

Nothing is required.

@ycbuzi

ycbuzi commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Tested f25303bfdd merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Windows Server 2022 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 99% tests passed, 2 tests failed out of 6448; 99% tests passed, 2 tests failed out of 6448. 2 of the failing tests fail on main too. run
  • Windows Server 2025 (GitHub-hosted runner), full build, WinLibs GCC 15.2.0: 100% tests passed, 0 tests failed out of 6448; 100% tests passed, 0 tests failed out of 6448. run

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@Jazeupoi Jazeupoi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran it on a second Mac: Apple M4, macOS 27.0.1, Apple clang (Command Line Tools), x86_64 Release build under Rosetta 2, main e825fa1492 with #17425 and #11049.

Merge with #17425: this PR adds its own if(APPLE) block with CMAKE_OSX_ARCHITECTURES to libcurl/CMakeLists.txt, at the same place #17425 adds one. So the hunk does not apply on a tree that has #17425, and the two PRs will conflict when the second one is merged. For this run I applied CurlSockets.cpp and its test from head f25303bfdd as they are, and added -DHAVE_POLL_FINE:BOOL=ON to #17425's existing line. curl_config.h then has #define HAVE_POLL_FINE 1. In main's build it is /* #undef HAVE_POLL_FINE */.

Tree guest_curl_sockets
this PR's test with main's code (select backend) fails 3 of 3 at CurlSockets.cpp:508, the new pipe wait check
this PR gets past that check and the rest of ErrorsAndExtraDescriptors, then fails 3 of 3 at CurlSockets.cpp:629 in MultiWakeupPoll
main fails 3 of 3 at CurlSockets.cpp:603, the same MultiWakeupPoll check

The MultiWakeupPoll failure is the drained poll after the two wakeups: curl_multi_poll with a 60 ms timeout returns in under 25 ms. It happens with and without this PR, so it is not caused by it. On this M4 it fails every run, not only now and then as on the M1 in the description.

AI-assisted: yes (Claude Code)

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head f25303bfdd, applied with git apply on main fd4aeed483 together with the other 26 PRs of one batch (#16367, #16415, #22363, #23103, #23366, #21547, #21742, #22774, #22852, #23420, #23952, #24346, #16945, #21718, #21780, #21912, #21931, #22061, #22425, #22619, #22657, #18765, #19662, #19767, #20899, #21571). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
guest_curl_sockets (1 test, matched by name to the test file this PR changes) all pass outside the iGPU subset

Whole batch: the full ctest -j 12 (6523 tests) on the RTX 3080 has 4 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. The 2126 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@Romannachwievor

Copy link
Copy Markdown
Contributor Author

@oneandonlydean, the Progress report workflow on the current head f25303bfdd was cancelled on 2026-11-20 (run 44671206176), so its report check shows as failed and the PR shows as unstable. I cannot re-run it from my account (gh run rerun needs admin rights). Could you re-run it when you have a moment? Nothing else is pending on my side.

AI-assisted: yes (Claude Code)

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built and ran the integrated curl socket fixture on Linux. It passed from a short working directory after the standard scratch path exceeded sun_path. I traced the macOS backend selection to the poll implementation. The macOS wakeup path still needs a Darwin run.

AI-assisted: yes.

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 17390 core/libs/prx/libcurl/CMakeLists.txt
PR 18468 core/libs/prx/libcurl/CMakeLists.txt
PR 27841 core/libs/prx/libcurl/CMakeLists.txt

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Dec 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants