Repository navigation
Desktop: extend the NVIDIA X11 WebKit fence fix to native packages - #10964
danielhanchen merged 3 commits into
Conversation
…TING Native NVIDIA X11 now defaults to compositing off, which makes this setting the only way back to the accelerated path for a host the module probe over-matches, such as a PRIME laptop presenting on its iGPU. It was an exact byte match on "0", so UNSLOTH_WEBKIT_DISABLE_COMPOSITING=false did nothing. That used to be harmless, because the native default was the transport-only fallback the opt-out selects anyway. It is not harmless now: the value silently leaves the host on the fallback it was trying to leave. Read it as a tri-state instead, trimmed and case folded, so 0/false/no/off turn the workaround off and 1/true/yes/on turn it on. Anything else is still not an instruction and the rule decides. Verified with an exhaustive replay of rendering_plan against origin/main over 770,703,360 environment and host combinations: with a value main already understood (unset, "0", "1") the only behaviour that moves is still native NVIDIA X11, and every other difference comes from a spelling main could not parse.
|
Went through this one carefully and simulated it rather than eyeballing it. Summary: the logic is correct, the scope claim holds, and I could not find anything it breaks. I pushed one small fix to the branch. Before and afterBefore, on a native package ( After, the same host also gets It is a real issue, not a fake one. #10795 has fd timelines, the What I verified
Windows and macOS cannot be affected. WSL2 is unaffected for a different reason: there is no SimulationsI replayed
Specifically on the things that worried me:
The one fix I pushed
297bf35 reads it as a tri-state, trimmed and case folded, so Tests are at 54 passing in Before mergingThe one thing none of this can establish is that the chosen combination fixes the actual driver. The A/B table in #10795 shows @Kalrkloss could you run this on your existing env WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 WEBKIT_FORCE_DMABUF_RENDERER=1 WEBKIT_DISABLE_COMPOSITING_MODE=1 /usr/bin/unsloth-studioIf Two notes for later, neither blocking and neither introduced here. The two red CPU jobs are unrelated to this PR: a skip guard assertion about |
Comment-only. Drops the lines that restate the code next to them (the variant doc that repeats variables(), the opt-out arm that repeats the variant name, the test line that repeats its own assertion) and collapses the rest, keeping every citation and every reason a reader would otherwise have to rediscover. 23 comment lines added by this PR down to 9. Verified comment-only by stripping Rust comments from both revisions and comparing the remaining code, which is byte identical at 32704 chars.
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…nslothai#10964) * Desktop: extend the NVIDIA X11 WebKit fence fix to native packages * Studio: accept the usual spellings for UNSLOTH_WEBKIT_DISABLE_COMPOSITING Native NVIDIA X11 now defaults to compositing off, which makes this setting the only way back to the accelerated path for a host the module probe over-matches, such as a PRIME laptop presenting on its iGPU. It was an exact byte match on "0", so UNSLOTH_WEBKIT_DISABLE_COMPOSITING=false did nothing. That used to be harmless, because the native default was the transport-only fallback the opt-out selects anyway. It is not harmless now: the value silently leaves the host on the fallback it was trying to leave. Read it as a tri-state instead, trimmed and case folded, so 0/false/no/off turn the workaround off and 1/true/yes/on turn it on. Anything else is still not an instruction and the rule decides. Verified with an exhaustive replay of rendering_plan against origin/main over 770,703,360 environment and host combinations: with a value main already understood (unset, "0", "1") the only behaviour that moves is still native NVIDIA X11, and every other difference comes from a spelling main could not parse. * Studio: tighten the comments this PR adds Comment-only. Drops the lines that restate the code next to them (the variant doc that repeats variables(), the opt-out arm that repeats the variant name, the test line that repeats its own assertion) and collapses the rest, keeping every citation and every reason a reader would otherwise have to rediscover. 23 comment lines added by this PR down to 9. Verified comment-only by stripping Rust comments from both revisions and comparing the remaining code, which is byte identical at 32704 chars. --------- Co-authored-by: danielhanchen <[email protected]>
…) (unslothai#16322) Fixes unslothai#16318. Same cause as the flicker in unslothai#16028. On NVIDIA X11 the app turns WebKit compositing off below driver 610, which avoids the 580 driver's `sync_file` leak (unslothai#10795). The plan it uses (`WEBKIT_DMABUF_RENDERER_FORCE_SHM` + `WEBKIT_FORCE_DMABUF_RENDERER` + `WEBKIT_DISABLE_COMPOSITING_MODE`) works up to WebKitGTK 2.52, but on 2.54 the window stops presenting what WebKit draws. The report's video alternates between the UI and a blank off-white window 82 times in 11 seconds. `WEBKIT_DISABLE_COMPOSITING_MODE=1` alone is enough to trigger it on 2.54 with NVIDIA's libraries; with Mesa it renders. Who gets it: NVIDIA X11 hosts below driver 610 with a system WebKitGTK 2.54 (Debian 13, Fedora 43/44, Arch). Deb users there have had it since their distribution moved to 2.54. AppImage users there got it in v0.1.913, when the AppImage started running on the host's WebKitGTK 2.54 (unslothai#15503); v0.1.912's bundled 2.50.4 renders. The "Off" setting, "On" below driver 610 and `UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1` all reached the same plan, so none of them helped. ## Fix Every NVIDIA X11 path that turns compositing off now turns the DMA-BUF renderer off instead on WebKitGTK 2.54 and newer: Auto below driver 610, Off, On below 610, and `UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1`. This is the `WEBKIT_DISABLE_DMABUF_RENDERER=1` workaround the report confirmed. Below 2.54 those paths keep the shared-memory plan, which renders there and is what unslothai#10964 chose because disabling DMA-BUF could leave Debian and Ubuntu's patched WebKit without a transport. Wayland, non-NVIDIA hosts and NVIDIA X11 at driver 610 or newer are unchanged. ## A/B results v0.1.912 and v0.1.913 release builds, and this branch before and after the follow-up commit, built with the Linux x64 steps of `release-desktop.yml`, ran in Debian 13, Fedora 44 and Ubuntu 24.04 containers with NVIDIA's userspace on an Xvfb display, with a fake driver 595 version file for the below-610 paths. Without a compositor, the broken presentation shows as a window that stays blank rather than flickering. | WebKitGTK | Auto, driver 595 | On, driver 595 | Off | `UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1` | | --- | --- | --- | --- | --- | | 2.54.0 (Debian 13), v0.1.913 | Blank | Blank | Blank | Blank | | 2.54.0 (Debian 13), this PR | Renders | Renders | Renders | Renders | | 2.54.2 (Fedora 44), this PR | Renders | Renders | Renders | Renders | | 2.52.6 (Ubuntu 24.04), this PR | Renders, unchanged plan | Renders, unchanged plan | Renders, unchanged plan | Renders, unchanged plan | | 2.50.4 (bundled), this PR | Renders, unchanged plan | Renders, unchanged plan | Renders, unchanged plan | Renders, unchanged plan | The first commit alone left On below 610 and `UNSLOTH_WEBKIT_DISABLE_COMPOSITING=1` blank on 2.54.0 and 2.54.2. The v0.1.912 deb is blank on Debian 13's 2.54.0 as well. Disabling DMA-BUF also stays clear of the 580 leak. On a GeForce MX150 with driver 580.178.04, the same continuous-scroll workload grew the web process to 367 `sync_file` descriptors in about 2 minutes with compositing on, and stayed at 0 for 5 minutes with `WEBKIT_DISABLE_DMABUF_RENDERER=1`, at 59 fps. ## Validation - **Rust tests:** all 837 `studio/src-tauri` binary tests pass, including a new case for each of the four paths on 2.50.4, 2.52.6, 2.54.0 and 2.54.2. - **Builds:** `verify-complete-appimage.sh` passed on both A/B builds. - **Not tested:** the flicker itself on an NVIDIA X server below driver 610 with WebKitGTK 2.54 (the test machine has driver 615), and Debian or Ubuntu's NVIDIA DMA-BUF patch on real NVIDIA hardware with WebKitGTK 2.52 or older. --------- Co-authored-by: oobabooga <[email protected]> Co-authored-by: Daniel Han <[email protected]>
Native Linux packages on NVIDIA X11 can leak WebKit
sync_filedescriptors until the web process reaches its file descriptor limit, leaving the window blank or frozen (#10795). #10214 applied a compositing-off fallback to the AppImage; this extends the same fallback to native packages.Closes #10795.
Change
Native NVIDIA X11 launches on WebKitGTK 2.44 or newer now set:
WEBKIT_DMABUF_RENDERER_FORCE_SHM=1WEBKIT_FORCE_DMABUF_RENDERER=1WEBKIT_DISABLE_COMPOSITING_MODE=1The first two variables preserve a nonempty shared-memory transport while compositing is disabled. Using
WEBKIT_DISABLE_DMABUF_RENDERER=1instead can leave Debian and Ubuntu's patched WebKit without a backing-store transport and trigger block/buzz#3654.Operator-set WebKit variables still take precedence.
UNSLOTH_WEBKIT_DISABLE_COMPOSITING=0restores the previous transport-only behavior.Verification
studio/src-tauriRust tests passed. The 53 focusedlinux_webkittests also passed after the final cleanup.sync_filedescriptors instead of 5 to 6. The opt-out restored the previous descriptor behavior.sync_filedescriptor, main and the opt-out reached the 1,024 descriptor limit and failed withCreating pipes for GWakeup: Too many open files. The compositing-off branch remained at 36 descriptors with nosync_fileentries.The natural leak did not reproduce on driver 610.43.02. The known reports used the 580 driver branch, so the fault-injection result validates that this change avoids the fence-producing path, not that it reproduces the original driver behavior.
Affected-host test
The exact fallback can be tested on the current
.debwithout a new build. Remove any existingWEBKIT_DISABLE_DMABUF_RENDERER=1override, then run:On an affected system, the
WebKitWebProcesssync_filecount should stay at 0 while the UI is used.Scope
Wayland, non-NVIDIA hosts, and WebKitGTK older than 2.44 are unchanged. All matching NVIDIA X11 systems take the fallback, including unaffected systems and PRIME setups where the NVIDIA module is loaded but an iGPU renders the desktop. Compositing-off performance can vary by workload;
UNSLOTH_WEBKIT_DISABLE_COMPOSITING=0is the opt-out.