Skip to content

bug: file-updater: an unreachable update host stalls shutdown for the OS TCP connect timeout (~75 s), failing the packaged-startup smoke test #2672

Closed

Description

@zackees

Location

shared/file-updater/file-updater/file-updater.c.h:100-135 — do_http_request sets CURLOPT_FAILONERROR and CURLOPT_NOSIGNAL but no CURLOPT_CONNECTTIMEOUT/CURLOPT_TIMEOUT, so curl_easy_perform blocks on an unreachable host for the kernel's TCP connect timeout.

shared/file-updater/file-updater/file-updater.c.h:36-42 — update_info_destroy joins that thread with an unbounded pthread_join(info->thread, NULL).

plugins/rtmp-services/rtmp-services-main.c.h:104 starts the update thread at module load (update_info_create, under #if defined(ENABLE_SERVICE_UPDATES)); plugins/rtmp-services/rtmp-services-main.c.h:122 calls update_info_destroy(update_info) from obs_module_unload, i.e. on the shutdown path.

The caller that trips over it: test/packaged-startup.py:601 proc.wait(timeout=30) (after SIGINT at :542).

Class

Liveness/robustness defect — shutdown is blocked on an unbounded network call. Not memory-unsafe.

How it is reached

Exit while the rtmp-services service-list update is in flight and the update host is unreachable. That is (a) an offline or firewalled user who quits soon after launch, and (b) the packaging smoke test on a runner with no egress to obsproject.com.

Evidence — release-rust.yaml run 40529110726, job 122287574932 Native macOS x86_64 DMG startup, head b926b01c, macos-26 image 20260824.0517. Scenario 2 (migrate-default) failed with subprocess.TimeoutExpired in close_frontend. The app's own frontend log:

15:36:08.966  [rtmp-services] module loaded      (update thread started)
15:36:09.559  ==== Shutting down ====
15:36:10.037  All scene data cleared
15:37:24.005  [rtmp-services plugin] Remote update of URL "https://obsproject.com/obs2_update/rtmp-services/v5/package.json"
              failed: Failed to connect to obsproject.com port 443 after 75005 ms: Couldn't connect to server
15:37:24.007  [obs-websocket] [obs_module_unload] Shutting down...

Shutdown stalled ~74 s (15:36:10 → 15:37:24) and resumed only when the connect gave up. sample of the still-running process (the harness samples it after the timeout):

+  obs_module_unload      (in rtmp-services) + 22
+    update_info_destroy  (in rtmp-services) + 41
...
+  update_thread         (in rtmp-services) + 1343
+    do_http_request      (in rtmp-services) + 345

The harness's bound (proc.wait(timeout=30)) is shorter than the ~75 s connect timeout, so the job fails.

Why scenario 1 passed: in fresh mode the same fetch succeeded in ~0.1 s before shutdown was requested (Successfully updated file 'services.json' (version 295) / Successfully updated package (version 295), 15:35:59.78/59.88); in scenario 2 the fetch was still in flight and the host was unreachable, so the join blocked.

Related but a different fault: #2432 is a SIGSEGV on arm64 during the same shutdown family; this failure is a stall on x86_64 with no crash report (a hang produces no .ips, so #2432's "wait for a crash report" path cannot cover it).

Proposed fix and failing test

Fix (preferred): bound the request in do_http_request — add CURLOPT_CONNECTTIMEOUT (short, e.g. 15 s) and a total CURLOPT_TIMEOUT (e.g. 60 s), with a comment; CURLOPT_NOSIGNAL is already set so the timeout is thread-safe. An unreachable host then fails fast instead of holding update_info_destroy's join. This also bounds the twitch/dacast/amazon single-file updaters, which share do_http_request.

Alternative (not preferred): raise the smoke test's wait. Rejected: the test's 30 s bound is a legitimate product requirement (the app should exit promptly), and the OS connect timeout is environment-specific (~75 s macOS, longer on Linux), so any test-side constant is brittle.

Failing test (RED → GREEN): Tier 2 (cmocka), next to test/cmocka/test_file_updater_failure.c: create an update_info against a TEST-NET address (192.0.2.0/24, guaranteed unroutable) and assert update_info_destroy returns within a few seconds — RED it blocks for the OS connect timeout, GREEN it returns at the connect-timeout bound. A narrower unit is to assert do_http_request installs a connect timeout on its curl handle.

Not verified

Activity

  1. added
    bug
    on Oct 27, 2026
  2. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    /ready
    Triage: the location, class, reach and fix are all named (a missing curl connect/transfer timeout in do_http_request, joined unbounded by update_info_destroy), so this is Ready — size S, no open questions.

  3. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Claiming: #2672

    Plan (one unit, one PR):

    1. Add CURLOPT_CONNECTTIMEOUT (15 s) and CURLOPT_TIMEOUT (60 s) to do_http_request in shared/file-updater/file-updater/file-updater.c.h, with a comment tying it to the unbounded pthread_join in update_info_destroy.
    2. RED: a Tier 2 cmocka case that points an update_info at an unroutable TEST-NET host and fails while update_info_destroy blocks for the OS connect timeout.
    3. GREEN: the bound makes it return promptly.
      First PR: this tick if the Tier 2 lane builds locally, otherwise next tick — I will open it as a draft as soon as the RED exists.
  4. added
    ready
    on Oct 27, 2026
  5. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Progress (worker, obs-studio5): PR #2673, branch fix/2672-file-updater-connect-timeout.

    • RED 343f534b — test/cmocka/test_file_updater_timeout.c (+ tests.d/ wiring): an update_info against RFC 5737 TEST-NET-1, update_info_destroy must return in < 40 s. Test + wiring only; the fix is not in it.
    • GREEN 30d11d9c — CURLOPT_CONNECTTIMEOUT 15 s + CURLOPT_TIMEOUT 60 s in do_http_request, and a docs/features.md ledger line (Fixed upstream bugs / Stability — the missing deadline is upstream's too).

    Local RED evidence: the code sets no deadline (file-updater.c.h:106-121), and a raw connect to 192.0.2.1:81 on this host takes the kernel default 133.2 s (tcp_syn_retries=6) with no --connect-timeout — the ~75 s the macOS runner measured is the same OS default. This checkout has no warm Tier 2 build volume, so the RED/GREEN runs are on PR CI (the new cmocka case is Linux Tier 2); I did not build the app locally.

    Refs/Fixes both #2672 and #2671 — the bound removes the 75 s shutdown stall that fails the packaged-startup smoke test.

  6. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Merged in #2673 (42ed9b2e2). The rtmp-services remote update can no longer hold obs_module_unload -> update_info_destroy -> pthread_join for the OS TCP connect timeout.

    What landed:

    • shared/file-updater/file-updater/file-updater.c.h: CURLOPT_CONNECTTIMEOUT 15 s + CURLOPT_TIMEOUT 60 s in do_http_request, with the comment tying them to the unbounded join.
    • RED/GREEN: test/cmocka/test_file_updater_timeout.c -- an update_info against RFC 5737 TEST-NET-1 must have update_info_destroy return in < 40 s (RED on master, GREEN with the bound).
    • docs/features.md ledger line (Fixed upstream bugs / Stability).

    What's left: nothing in the fix. The test/packaged-startup.py 30 s shutdown budget is deliberately unchanged -- the connect bound (15 s) is what removes the ~75 s stall, so the budget now has headroom. #2671 (the macOS x86_64 DMG startup smoke test's shutdown timeout) was the same root cause and is closed with this.

    Checked while here: the other in-tree curl call sites are already bounded (nimotv.c.h 3 s, showroom.c.h 30 s, whip-output.cpp.hpp 8 s, RemoteTextThread.cpp.hpp timeoutSec), so no sibling of this gap remains.

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

Metadata

Metadata

Assignees

Labels

bugready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions