Skip to content

overlay: Empty LD_PRELOAD early to avoid Steam overlay launch deadlock#1312

Open
SuperHubber3 wants to merge 1 commit into
sonic2kk:masterfrom
SuperHubber3:fix-steam-overlay-ldpreload-deadlock
Open

overlay: Empty LD_PRELOAD early to avoid Steam overlay launch deadlock#1312
SuperHubber3 wants to merge 1 commit into
sonic2kk:masterfrom
SuperHubber3:fix-steam-overlay-ldpreload-deadlock

Conversation

@SuperHubber3

Copy link
Copy Markdown

overlay: Empty LD_PRELOAD early to avoid Steam overlay launch deadlock

Problem

With SteamTinkerLaunch set as the compatibility tool and the Steam in-game overlay enabled, launching a game hangs before the game starts. Steam sits at "running" (green) until the process is killed. The waitforexitandrun STL process stays alive but never spawns Proton or the game, and the per-game log stops partway through loadLanguage, right after Loading found system wide .../english.txt.

I hit this on God of War (appid 1593500) with proton-cachyos. The trigger is the overlay, not the game or the Proton build.

Cause

When the overlay is enabled, Steam sets LD_PRELOAD to the 32-bit and 64-bit gameoverlayrenderer.so and STL inherits it. main() then runs many forked subprocesses (every writelog call spawns echo/tee/date), starting with loadLanguage, before saveOrgVars/emptyVars clear LD_PRELOAD further down (after getCurrentCommandline). The overlay library's atfork handler deadlocks one of those short-lived subprocesses, so writelog never returns and STL hangs during early init.

Under bash -x, the last statement that runs is echo ... | tee -a "$PRELOG" inside writelog, and the child never exits. From that point stderr fills with:

ERROR: ld.so: object '.../ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
pid <N> != <M>, skipping destruction (fork without exec?)

which is the overlay being preloaded into STL's own subprocesses and interfering with them.

Fix

Clear LD_PRELOAD right after setAIDCfgs, before the fork-heavy logging, and stash the original in ORG_LD_PRELOAD first. saveOrgVars now keeps that stashed value instead of overwriting it, so restoreOrgVars still hands the overlay back to the game at launch. The overlay keeps working in-game; only STL's own shell runs without it.

This reuses the existing saveOrgVars / emptyVars / restoreOrgVars path, so it is the same mechanism STL already relies on, applied before the first heavy logging instead of after getCurrentCommandline.

Testing

Reproduced by capturing the environment Steam passes to STL and running waitforexitandrun by hand:

  • Overlay LD_PRELOAD present, unpatched: hangs in writelog during loadLanguage; no game process is ever created.
  • Same environment, patched: reaches ## GAMESTART HERE ###, launches the Proton command and the forked custom command, and both processes stay up.

bash -n passes on the patched script. PROGVERS bumped to v14.0.20260707 per CONTRIBUTING.

Copilot AI review requested due to automatic review settings July 7, 2026 16:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Steam overlay–related startup hang when SteamTinkerLaunch (STL) is used as a Steam compatibility tool by clearing LD_PRELOAD earlier in main() to avoid deadlocks in fork-heavy early logging, while preserving the original LD_PRELOAD for later restoration when launching the game.

Changes:

  • Bump PROGVERS to v14.0.20260707.
  • Preserve an early-saved ORG_LD_PRELOAD in saveOrgVars instead of overwriting it.
  • Clear LD_PRELOAD immediately after setAIDCfgs in main() to avoid Steam overlay atfork deadlocks during early initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread steamtinkerlaunch Outdated
Comment thread steamtinkerlaunch Outdated
When STL runs as a compatibility tool with the Steam overlay enabled, Steam preloads gameoverlayrenderer.so into STL's own shell via LD_PRELOAD. main() then does a large amount of forked logging (loadLanguage and friends) before saveOrgVars/emptyVars clear LD_PRELOAD. The overlay's atfork handler deadlocks those short-lived subprocesses, so STL hangs during early init and never launches the game; Steam stays stuck at "running".
Clear LD_PRELOAD right after setAIDCfgs, before the fork-heavy logging, and save the original so restoreOrgVars still hands the overlay to the game. saveOrgVars keeps the earlier-saved value instead of overwriting it.
@SuperHubber3
SuperHubber3 force-pushed the fix-steam-overlay-ldpreload-deadlock branch from feaf9ee to d674ad2 Compare July 7, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants