Skip to content

bug: in-tree OBS intermittently crashes during websocket Tier 4 request coverage #476

Closed

Description

@zackees

Symptom

The in-tree OBS full-app build intermittently exits with SIGSEGV (139) during test/websocket-tier4/run_tier4.py --no-spawn --skip-auth-phase, just after the input audio and replay-buffer requests and before GetOutputList. The remaining requests then fail with connection refused.

This occurs with the original plugins/obs-websocket commit 073a294 and with the bounded-parser change from #99. In the same Docker build and headless Xvfb setup, one baseline run completed 147/147 documented request types (172/173 checks; SaveSourceScreenshot was the sole failure), and a second baseline run crashed at GetOutputList (94/173 checks). The patched runs also crashed at this point, while the focused #99 depth regression passed and the server remained alive immediately afterward.

Reproduction and next step

Build the full app with ENABLE_WEBSOCKET=ON, ENABLE_RUST_LIBOBS=OFF, and the usual optional unavailable plugins off. Run it under Xvfb with an isolated profile and the Tier 4 suite attached with --no-spawn --skip-auth-phase. A debugger or crash stack is needed to determine whether a specific request or asynchronous OBS operation causes the fault. Compare the same build with the original submodule commit and the #99 fork commit; the crash has reproduced on both.

The Tier 4 logs from the two baseline runs are in /tmp/ws99-orig-XXXXXX/tier4.log and /tmp/ws99-orig2-XXXXXX/tier4.log in the investigating workspace. See #99 for the independent pre-auth nesting defect.

Activity

  1. added
    bug
    claimed
    on Oct 13, 2026
  2. zackees commented on Oct 13, 2026

    @zackees
    MemberAuthor

    Claiming.

  3. zackees commented on Oct 13, 2026

    @zackees
    MemberAuthor

    Investigated; could not reproduce, so no fix. Releasing the claim.

    Setup: master c553fd9, full app (RelWithDebInfo, ENABLE_WEBSOCKET=ON, ENABLE_RUST_LIBOBS=OFF, browser/AJA/VLC/WebRTC/scripting/VST/PipeWire/NVENC/Wayland off, websocket submodule at a4040cb) in the obs-rust-linux-validate Docker image. OBS ran under gdb -batch (SIGSEGV would print bt) in Xvfb with an isolated HOME and websocket config (port 4455, auth off). test/websocket-tier4/run_tier4.py --no-spawn --skip-auth-phase was run against it, one fresh OBS per run.

    Results: about 80 runs in total, serial, 3 containers in parallel, and 4 containers at --cpus 1. 77 runs passed 177/177 checks with 147/147 request types, including SaveSourceScreenshot (the issue saw it fail once). 3 runs exited 1 with ConnectionRefused. In those, OBS had not opened the websocket port within my 60 s startup wait under CPU contention. gdb saw no signal, so that is a harness wait issue, not a crash. No SIGSEGV, no core.

    Static look at GetOutputList (Obs_ArrayHelper.cpp) and libobs obs_output_get_width/height: video-less outputs are NULL-safe (video_output_get_width(NULL) returns 0), and obs_enum holds the outputs mutex. I found nothing obviously unsafe.

    Hypotheses for whoever picks this up:

    1. The crash may depend on the original environment (host and timing, different Qt/FFmpeg, or leftover state from the preceding replay-buffer/input requests).
    2. The issue's "crashed at GetOutputList" is inferred from where the client got connection refused, and the crash may have happened slightly earlier, in an async OBS thread such as the replay buffer or audio monitoring.

    Next step: get an ASan/TSan build of the full app, or enable core dumps (ulimit -c unlimited plus coredumpctl) in the original workspace, then run this loop. My scripts are in the session scratchpad and can be pasted on request. Please also keep the original logs, which were only in /tmp.

  4. removed
    claimed
    on Oct 13, 2026
  5. vpacher commented on Oct 16, 2026

    @vpacher
    Member

    Not claiming. A second environment does not reproduce it either. Data for whoever picks this up.

    Host: Debian 13 LXC (Proxmox, kernel 7.0.14), Qt 6.8.2 (distro), FFmpeg 8.0.3, GCC. No Docker. A production OBS instance ran next to the tests (4K NDI input, so the CPU and GPU were under real load).

    Method: one fresh OBS per run, isolated HOME, websocket on its own port (auth off), --multi. Then run_tier4.py --no-spawn --skip-auth-phase. ulimit -c unlimited for cores. Each run checks that OBS is still alive after the suite.

    Build Display / GL Runs Crashes
    master 4f270ee, ENABLE_RUST_LIBOBS=ON, RelWithDebInfo Xvfb, Mesa llvmpipe 25 0
    same real X server, NVIDIA RTX 3060 (595.104) 25 0
    master 4f270ee, ENABLE_RUST_LIBOBS=OFF, ASan (-fsanitize=address, detect_leaks=0), websocket submodule f9e2a95 Xvfb, Mesa llvmpipe 20 0, no ASan report
    same ASan build real X server, NVIDIA 20 0, no ASan report

    Every run exercised 147/147 request types. The only failed check was GetVirtualCamStatus (604 "VirtualCam is not available"): this host has no v4l2loopback, so this is environmental. Startup and shutdown under ASan were also clean (exit 0 after SIGTERM).

    So in 90 runs on bare metal plus zackees' 80 in Docker, there was no SIGSEGV, and ASan found no memory error on the Tier 4 path. The original crash may need the original environment, or it may have come from leftover state in a profile that was reused between runs (the original runs did not use one fresh profile per run, as far as I can see from the report).

    All builds above also have one local commit: #1017 (Qt 6.8 build fix; no effect at runtime). The two RUST_LIBOBS=ON rows also have obs-rust/obs-websocket#12 in the websocket submodule (it queues a frontend save after requests that change the collection); the ASan rows use the stock submodule.

  6. zackees commented on Oct 16, 2026

    @zackees
    MemberAuthor

    @vpacher thank you. Two more environments without a reproduction (90 clean runs on bare metal, 40 of them under ASan with no report, plus the earlier ~80 in Docker) is useful, and your suggestion that a reused profile may be involved is the best lead so far.

    Next: leaving this open and unclaimed, without a fix. I have not asked for more from the original reporter, since the original logs were only in /tmp of that workspace and the report already names what is needed. If the crash shows up again, a core dump or backtrace (ulimit -c unlimited, coredumpctl) plus the profile that was in use would turn this into a fixable bug. Without that it stays here as reference data, and the issue can be closed as not reproducible if nothing new appears.

  7. zackees commented on Oct 25, 2026

    @zackees
    MemberAuthor

    /investigate

    Triage: no reproduction since the original reports (about 170 clean runs, 40 under ASan, across Docker and bare metal), and no crash stack. Missing for Ready: a backtrace or core from a crashing run. The best lead is the reused-profile idea above, so a run against a profile that already held the Tier 4 sources and outputs is the next thing to try. Until someone has a stack, this stays under investigation.

  8. added
    needs-investigation
    on Oct 25, 2026
  9. moved this from Triage to Investigating in obs-rust Multiviewon Oct 25, 2026
  10. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Triage: the leading hypothesis still cannot be tested with the harness in the tree, which is the useful thing this comment can change.

    What I verified:

    • The leading lead from 10-16 is "a profile that already held the Tier 4 sources and outputs". run_tier4.py cannot do that today. ObsServer.__init__ accepts a keep_home (test/websocket-tier4/run_tier4.py:117-126), but each phase creates its own tempfile.mkdtemp(prefix="obs-tier4-") (for example run_shutdown_phase, :1683) and the CLI exposes only --obs, --no-spawn, --skip-auth-phase, --only, --test-plugin-dir (:2186-2205). So HOME is fresh per run (env["HOME"] = self.home, :176) and _write_profile() (:129) rewrites the Tier4 profile each time — exactly the state zackees suspects is the trigger is the state the harness removes.
    • The rest of the issue still stands: ~80 runs in Docker plus 90 on bare metal (40 under ASan) without a SIGSEGV, no core, and the original /tmp logs gone.

    Missing for Ready: one backtrace or core from a crashing run (ulimit -c unlimited + coredumpctl, or run the full app under gdb -batch as zackees did and keep the output). A count of clean runs is not a reproduction, so there is nothing a failing test could be written against and nothing to fix.

    The claimable work that does exist here is the harness: add a --home DIR (or --config-dir) option at :2186-2205 that passes keep_home through so a second run reuses the first run's profile and sources, acceptance "run the suite twice against one directory; the second run starts with the first run's profile and collection". That is a small, testable task and it is worth filing as its own issue — it is what would let someone test the hypothesis above. This issue stays here, unassigned, as reference data; if no stack arrives, closing it as not reproducible is the right end, not a fix.

  11. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    The crash is explained by a bug master already fixed, so there is nothing left to reproduce or fix here; the right end is closing this as fixed. #469 / #470 (049e7c8d9, "libobs: Move raw outputs to the new video mix on obs_reset_video") landed at 2026-10-13 06:59:50Z, nine minutes before this issue was opened at 07:09:31Z, and every reproduction attempt since has been on a master that contains it.

    The code path, on origin/master (64a055b1a):

    1. test/websocket-tier4/run_tier4.py:616 sends SetVideoSettings (1280x720, fps 30/1) early in the documented request list, before the input and output requests.
    2. plugins/obs-websocket/src/requesthandler/RequestHandler_Config.cpp:511-515 saves the profile and calls obs_frontend_reset_video() unconditionally for any of those fields — it does not compare the new values with the current ones.
    3. frontend/OBSStudioAPI.cpp.hpp:629-632 → frontend/widgets/OBSBasic.cpp.hpp:1418 OBSBasic::ResetVideo() → AttemptToResetVideo() → obs_reset_video (libobs/obs.c.h:1504), which frees every video mix.
    4. A raw (non-encoded) output stores obs_get_video() once, at creation: libobs/obs-output.c.h:232-234. The frontend creates several raw outputs at startup — frontend/utility/SimpleOutput.cpp.hpp:45 (ffmpeg), :220 (replay buffer), frontend/utility/BasicOutputHandler.cpp.hpp:216 (virtual cam) — and before libobs: Move raw outputs to the new video mix on obs_reset_video #470 nothing repointed them after the reset, so each held a freed video_t.
    5. run_tier4.py:747 sends GetOutputList (right after the replay-buffer status reads at :742-746, which is the position the report names) → plugins/obs-websocket/src/utils/Obs_ArrayHelper.cpp:381-382 → obs_output_get_width (libobs/obs-output.c.h:1367) → OBS_OUTPUT_SIZE_VIDEO → video_output_get_width(output->video) at :1360, reading the freed video_t. GetOutputList reads outputWidth/outputHeight for every output, so one stale raw output is enough.

    A read of a freed but still-mapped allocation usually returns the old bytes, so it faults only sometimes. That matches the one-crash-in-two-baselines pattern, and it is why the crash did not correlate with which websocket submodule commit was in use.

    Why 170 runs did not reproduce it: the two later campaigns were already on fixed master. c553fd90 (zackees, 2026-10-13 16:38Z) and 4f270ee (vpacher, 2026-10-16 07:05Z) both contain 049e7c8d9 — git merge-base --is-ancestor 049e7c8d9 c553fd90 and the same for 4f270ee both succeed. The ASan runs were clean for the same reason. The separate encoded-output variant of the same bug (#1109, c651ea23c, 2026-10-16 19:40Z) is also on master now, so a later stream-then-GetOutputList ordering would not fault either.

    The fix and its guard are on master: repoint_outputs (libobs/obs.c.h:1388-1406) points every output that held a freed mix at the new mix of the same canvas, called after the reset at :1540, plus the core_video_release signal at :1528. The deterministic regression test is test/cmocka/test_raw_output_video_reset.c (registered in test/cmocka/tests.d/test_raw_output_video_reset.cmake:5-24), which pins the freed video_t addresses so a stale pointer cannot hide. The user-visible entry is docs/features.md:2032-2039 ("Changing the video resolution or profile no longer leaves raw outputs on freed memory, so obs-websocket GetOutputList ... no longer crash after it").

    Acceptance for closing: nothing to build. If someone wants the original claim checked rather than the mechanism, the one command is git merge-base --is-ancestor 049e7c8d9 <sha of the crashing build>; if that fails, the build predates the fix and the crash is accounted for.

    The only real gap left is test coverage in this suite, and it is worth a separate Tiny issue rather than a fix: run_tier4.py:747 asserts only that GetOutputList succeeds, so nothing in Tier 4 would notice the size being stale or the output path regressing. A black-box guard would be: after SetVideoSettings to 1280x720, require every output in GetOutputList whose outputFlags.OBS_OUTPUT_VIDEO is true to report outputWidth 1280 and outputHeight 720. That discriminates, because the coverage phase starts OBS with no profile at all (run_tier4.py:2084, so _write_profile is skipped at :171-174) and first-run video is 1920x1080 (frontend/widgets/OBSBasic.cpp.hpp:1447-1452), so a stale video_t reports 1920. On a build with repoint_outputs removed (libobs/obs.c.h:1540) the check fails on the old size and ASan reports the read; on master it passes. If that guard is filed it is Ready as written; this issue should be closed as fixed.

  12. moved this from Investigating to Done in obs-rust Multiviewon Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-investigation

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions