overlay: Empty LD_PRELOAD early to avoid Steam overlay launch deadlock#1312
Open
SuperHubber3 wants to merge 1 commit into
Open
overlay: Empty LD_PRELOAD early to avoid Steam overlay launch deadlock#1312SuperHubber3 wants to merge 1 commit into
SuperHubber3 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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
PROGVERStov14.0.20260707. - Preserve an early-saved
ORG_LD_PRELOADinsaveOrgVarsinstead of overwriting it. - Clear
LD_PRELOADimmediately aftersetAIDCfgsinmain()to avoid Steam overlay atfork deadlocks during early initialization.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
force-pushed
the
fix-steam-overlay-ldpreload-deadlock
branch
from
July 7, 2026 17:05
feaf9ee to
d674ad2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
waitforexitandrunSTL process stays alive but never spawns Proton or the game, and the per-game log stops partway throughloadLanguage, right afterLoading 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_PRELOADto the 32-bit and 64-bitgameoverlayrenderer.soand STL inherits it.main()then runs many forked subprocesses (everywritelogcall spawnsecho/tee/date), starting withloadLanguage, beforesaveOrgVars/emptyVarsclearLD_PRELOADfurther down (aftergetCurrentCommandline). The overlay library's atfork handler deadlocks one of those short-lived subprocesses, sowritelognever returns and STL hangs during early init.Under
bash -x, the last statement that runs isecho ... | tee -a "$PRELOG"insidewritelog, and the child never exits. From that point stderr fills with:which is the overlay being preloaded into STL's own subprocesses and interfering with them.
Fix
Clear
LD_PRELOADright aftersetAIDCfgs, before the fork-heavy logging, and stash the original inORG_LD_PRELOADfirst.saveOrgVarsnow keeps that stashed value instead of overwriting it, sorestoreOrgVarsstill 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/restoreOrgVarspath, so it is the same mechanism STL already relies on, applied before the first heavy logging instead of aftergetCurrentCommandline.Testing
Reproduced by capturing the environment Steam passes to STL and running
waitforexitandrunby hand:LD_PRELOADpresent, unpatched: hangs inwritelogduringloadLanguage; no game process is ever created.## GAMESTART HERE ###, launches the Proton command and the forked custom command, and both processes stay up.bash -npasses on the patched script.PROGVERSbumped tov14.0.20260707per CONTRIBUTING.