Skip to content

[Unsloth Bug] X11 + NVIDIA: WebKitWebProcess leaks DMA-BUF sync_file fds until EMFILE — blank/frozen window (looks like a hang) #10795

Closed

Description

@Kalrkloss

Environment

Where are you using Unsloth?

  • Unsloth desktop application
  • Unsloth web UI (unsloth studio)
  • Unsloth CLI
  • Python package or notebook
  • Colab or Kaggle

Operating system and version: Linux Mint 21.3 "virginia" (Ubuntu 22.04 base), kernel 6.8.0-138-generic, X11 session (no Wayland, WAYLAND_DISPLAY unset)

GPU model(s) and accelerator backend: NVIDIA GeForce RTX 3070, CUDA, driver 580.178.04 (CUDA 13.0)

Versions:

  • Unsloth Studio 2026.9.4, installed from the unsloth .deb (/usr/bin/unsloth-studio)
  • WebKitGTK: libwebkit2gtk-4.1-0 2.50.4-0ubuntu0.22.04.1
  • Desktop backend unsloth studio --api-only starts normally, reports Hardware detected: CUDA -- NVIDIA GeForce RTX 3070
  • Soft RLIMIT_NOFILE 1024 / hard 1048576 (stock systemd/Ubuntu defaults, nothing custom in limits.conf)

What happened?

Steps to reproduce:

  1. Install the .deb and launch Unsloth from the application menu (or run /usr/bin/unsloth-studio) on an X11 session with an NVIDIA GPU and the stock soft fd limit of 1024.
  2. The window opens and the backend starts normally.
  3. Within 5-40 seconds the WebKit web content process dies and the window is left blank/frozen. No error dialog, no crash reporter — the main app process stays alive at ~6% CPU, so to a user this looks like the app "hanging", not crashing.
  4. If the fd limit is raised instead (e.g. ulimit -n 65536), the window works for a while, but the renderer's fd count climbs to the new ceiling and then the UI wedges at it.

Expected behavior: the Studio window stays usable.

Actual behavior: the renderer exhausts the file descriptor limit and either aborts or wedges; the window is permanently blank/frozen while the process tree stays alive.

Model and operation involved: none specific — this happens on the Model hub / startup screen. It reproduced with nothing downloaded and no model loaded, and also during a GGUF hub download.

Diagnostics and logs

The renderer's last words, from ~/.unsloth/studio/tauri.log (captured three separate times; local time CEST):

(WebKitWebProcess:30270): GLib-ERROR **: 15:25:55.997: Creating pipes for GWakeup: Too many open files
(WebKitWebProcess:30687): GLib-ERROR **: 15:27:09.677: Creating pipes for GWakeup: Too many open files
(WebKitWebProcess:31306): GLib-ERROR **: 15:50:07.237: Creating pipes for GWakeup: Too many open files

coredumpctl list for the same session — every core is a WebKitWebProcess, SIGABRT or SIGTRAP:

15:17:11  SIGTRAP  WebKitWebProcess
15:24:09  SIGABRT  WebKitWebProcess
15:25:59  SIGTRAP  WebKitWebProcess
15:27:13  SIGTRAP  WebKitWebProcess
15:50:07  SIGABRT  WebKitWebProcess

The cores are stored truncated (~1.7-33 MB), so no usable backtrace.

The resource that runs out: anon_inode:sync_file (DMA-BUF fences).
ls -l /proc/<WebKitWebProcess>/fd, on a run launched with ulimit -n 65536:

anon_inode:sync_file   12367      <- at ~2 minutes uptime
/dev/nvidia               27
/dev/nvidia-modeset        5
/dev/nvidiactl             4
/dev/dri/renderD*          2

Growth is monotonic and UI-activity-bound: roughly 130-200 new sync_file fds per second while the UI is busy, plateauing when it is idle. Timeline of that single run: 12,367 -> 32,408 -> 52,510 (4 min) -> 55,409 -> and when I let it run further it reached 65,534 of 65,536 and simply stopped responding, with no core dump (the UI froze at the ceiling rather than aborting).

At the same moments, dmesg shows the driver side of the same exhaustion — -24 is EMFILE:

drm:nv_drm_semsurf_fence_create_ioctl [nvidia_drm] *ERROR* [GPU ID 0x00000900] Failed to create sync file from fence on ctx 0x00000004
drm:nv_drm_semsurf_fence_wait_ioctl [nvidia_drm] *ERROR* [GPU ID 0x00000900] Attempt to wait on invalid sync FD: -24

These fds are never released. With soft 1024 the process dies within seconds of startup; with 65,536 it survives minutes and then wedges; the limit only controls how long it takes, so raising RLIMIT_NOFILE is not a fix.

A/B results on this machine

Configuration Result
Default (soft NOFILE 1024) renderer dead in 5-40 s, every run (4/4), core dumped
ulimit -n 65536 works, but sync_file fds climb to the ceiling, then UI wedges
WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 WEBKIT_FORCE_DMABUF_RENDERER=1 (the pair the app's own log recommends "for WebKitGTK compatibility") does not help — renderer died the same way (15:25:59)
WEBKIT_DISABLE_DMABUF_RENDERER=1 fixes it — renderer stable for the whole 2.5+ min observation on the stock 1024 limit, /proc/<pid>/fd flat at 30-34, sync_file count 0, UI renders fully and normally

Sanity check that this is not WebKitGTK in general: a minimal GTK3 + WebKit2 4.1 WebView in this same session, rendering an animated WebGL canvas, held a flat 47-49 fds with 3 sync_file fds and never grew. The churn needs the Studio UI on the DMABUF renderer path.

Relations to existing issues

Additional context

The workaround I applied locally is a user-level desktop entry so the switch is always present:

Exec=env WEBKIT_DISABLE_DMABUF_RENDERER=1 /usr/bin/unsloth-studio %u

Suggestions, in order of usefulness to me:

  1. Treat "X11/non-Wayland + NVIDIA" like the AppImage/Wayland rows and set WEBKIT_DISABLE_DMABUF_RENDERER=1 (a cheap probe would be the presence of /sys/module/nvidia while there is no Wayland session). I understand from Studio on Linux: WEBKIT_DISABLE_DMABUF_RENDERER=1 is full software rendering on WebKitGTK 2.44+, and we set it for AppImage on Wayland #9393 that this costs accelerated compositing; for NVIDIA/X11 users that is much better than a window that dies in 10 seconds.
  2. Consider a startup check that warns when the soft RLIMIT_NOFILE is low — but note it only delays this, since the fds are never returned, so it should not be presented as a solution.
  3. The actual leak is upstream in the WebKitGTK DMABUF renderer / the nv_drm fence export path (the invalid sync FD: -24 messages are the smoking gun); worth a WebKit Bugzilla entry with the fd timelines above if you agree with the diagnosis.

Happy to run any instrumented build, paste more of tauri.log//proc/<pid>/fd at specific moments, or test a patch — this machine reproduces it in well under a minute with the stock fd limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions