Skip to content

bug: frontend: SIGTERM is ignored while recording (exit confirmation) or while a dialog waits, and the recording is cut off (upstream #10011) #1402

Closed

Description

@rdoupe

Upstream bug: obsproject/obs-studio#10011, "OBS does not cleanly exit when sent SIGTERM", reported by Mikilio in December 2023 and still open (it replaced #9877, which was closed). Other users there: VladimirMrzv, rob215x, zzzeek ("how can OBS be cleanly terminated without using the UX?") and zyd-n ("Maybe one day I can cleanly exit obs from the command line?").

In this fork an idle OBS already quits cleanly on SIGTERM. Two cases still ignore it.

Location

  • frontend/OBSApp.cpp.hpp, OBSApp::processSigTerm(): saves, then calls quit(), which closes the main window.
  • While recording or streaming: frontend/widgets/OBSBasic.cpp.hpp, OBSBasic::closeEvent(). With an output active and "Show confirmation on exit while outputs are active" on (the default, ConfirmOnExit), shouldPromptForClose() is true, so it ignores the close and opens the "exit anyway?" dialog.
  • While a modal dialog waits, for example the "encoder missing" warning the main window opens during its startup (OBSBasic_Profiles.cpp.hpp): the dialog runs its own event loop and the quit ends nothing. Before the main event loop has started, quit() does nothing at all.

Class

Data loss: the recording is cut off when the sender gives up and kills OBS, and the next start is an unclean one.

How it is reached

Start a recording, then kill <pid>, systemctl stop for a unit running OBS, or log out or shut down (logind sends SIGTERM). Or start OBS with a profile whose encoder is missing and send SIGTERM while the warning is up. Nobody answers the dialog, so OBS stays up until the sender's timeout and SIGKILL.

Reproduced in the current release

v0.1.0-beta.20261014 AppImage, headless (private Xvfb, private D-Bus, fresh HOME), driven over obs-websocket: Simple output, x264, MKV, exit confirmation left on.

Build State at SIGTERM 30 s later Recording
v0.1.0-beta.20261014 AppImage idle quit after 0.3 s, clean shutdown none
v0.1.0-beta.20261014 AppImage recording 4 s still running, no "Shutting down" in the log unfinished, ffprobe finds no duration
master 3fa2833 recording 4 s still running (the dialog is open) 0 bytes
master 3fa2833 "encoder missing" startup dialog open still running none

Fix

On SIGTERM, close without the exit confirmation (nobody can answer it), so closeWindow() stops the outputs and waits for the recording to finish, as when the dialog is answered with Yes. If a modal dialog is open, dismiss it and quit once its loop has returned; quit right after a startup that SIGTERM interrupted. Closing the window, Exit in the menus and SIGINT keep the confirmation. PR follows.

Activity

  1. rdoupe commented on Oct 18, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue. RED (Tier 4 shutdown phase) and GREEN are ready; PR follows once the full test run finishes.

  2. added
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 18, 2026
  3. rdoupe commented on Oct 18, 2026

    @rdoupe
    CollaboratorAuthor

    @Mikilio you reported this in obsproject/obs-studio#10011: OBS does not exit cleanly when sent SIGTERM. That's fixed here in obs-rust by #1403, merged today with a regression test.

    SIGTERM now quits OBS while it records or streams, without the "exit anyway?" dialog nobody can answer, and the recording is finished first. It also quits while a modal dialog waits, including one shown during startup. Closing the window and Exit in the menus still ask, and SIGINT is unchanged.

    Tested headless, recording with the exit confirmation on. 0.1.0-beta.20261014 was still running 30 s after SIGTERM and left an unfinished file. With the fix, OBS quits after 1.2 s with a clean shutdown in the log, and the MKV is complete (ffprobe: 4.97 s).

    It will be in the next obs-rust daily release after 0.1.0-beta.20261018: https://github.com/obs-rust/obs-studio/releases (Windows, macOS and Linux builds; on Arch it's obs-studio-rust-git in the AUR). obs-rust is an AI-assisted fork of OBS, based on current OBS master, with extra bug fixes like this one.

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

    claimedAn agent or person has claimed this; check the claim comment before starting

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions