Skip to content

Defer early match autoload to mitigate client crashes - #1010

Open
norths7ar wants to merge 2 commits into
SirPlease:masterfrom
norths7ar:fix/autoload-after-connect-full
Open

norths7ar wants to merge 2 commits into
SirPlease:masterfrom
norths7ar:fix/autoload-after-connect-full

Conversation

@norths7ar

@norths7ar norths7ar commented Sep 5, 2026 •

Copy link
Copy Markdown

My client kept crashing when joining with confogl_match_autoload enabled. Loading ZoneMod restarted the map while the client was still connecting.

This waits until player_connect_full, then runs autoload on the next frame. It also cancels pending autoload callbacks on map change or match unload.

The original version worked in my client tests. I've rebuilt it against current upstream but haven't retested in-game yet.

Engine investigation was ai-assisted; I did the client tests myself.

@norths7ar
norths7ar marked this pull request as ready for review September 6, 2026 02:30
@A1mDev

A1mDev commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

I’m not really convinced this should be considered a fix rather than a workaround.

The tests only demonstrate that moving autoload from OnClientPutInServer to player_connect_full makes the crash stop reproducing. The actual cause of the access violation hasn’t been identified.

The delay test is especially telling: deferring by one frame still crashes, while waiting roughly one second succeeds. That looks much more like a timing workaround — we’re simply avoiding the problematic window.

The generation counter also addresses a separate issue: preventing stale queued callbacks from running after a match unload or map end. It doesn’t address the cause of the crash itself.

I’d therefore describe this as a workaround for early autoload rather than a fix for the underlying crash. A proper fix would ideally reproduce this on a pristine upstream setup and identify what exactly about the autoload + map restart sequence causes the client-side AV in shaderapidx9.dll.

The workaround itself may be useful and worth keeping, but based on these results, I don’t think we can confidently claim that the underlying crash has been fixed.

@norths7ar

Copy link
Copy Markdown
Author

I’m not really convinced this should be considered a fix rather than a workaround.

The tests only demonstrate that moving autoload from OnClientPutInServer to player_connect_full makes the crash stop reproducing. The actual cause of the access violation hasn’t been identified.

The delay test is especially telling: deferring by one frame still crashes, while waiting roughly one second succeeds. That looks much more like a timing workaround — we’re simply avoiding the problematic window.

The generation counter also addresses a separate issue: preventing stale queued callbacks from running after a match unload or map end. It doesn’t address the cause of the crash itself.

I’d therefore describe this as a workaround for early autoload rather than a fix for the underlying crash. A proper fix would ideally reproduce this on a pristine upstream setup and identify what exactly about the autoload + map restart sequence causes the client-side AV in shaderapidx9.dll.

The workaround itself may be useful and worth keeping, but based on these results, I don’t think we can confidently claim that the underlying crash has been fixed.

Thanks, that distinction is fair. I’m not claiming this fixes the underlying null-pointer dereference in the client renderer.
The scope of this PR is to avoid the early-autoload sequence that reproduced the crash in my tests. The one-second delay was only a diagnostic experiment; the proposed change uses player_connect_full as an explicit connection milestone before scheduling the existing load path. The generation counter only guards against stale queued work.
I’m happy to describe this as a workaround for the observed crash and add a source comment explaining the reason for the timing change. I don’t currently have enough evidence to identify the renderer’s internal failure.
Would you consider this timing change acceptable on that basis, or is a pristine upstream reproduction required before merging?

@norths7ar

norths7ar commented Sep 7, 2026 •

Copy link
Copy Markdown
Author

I tested this further with a small plugin that reloads the map shortly after joining, without Confogl. It reproduced the same client crash.

The ai-assisted debugging pointed to queued rendering still being enabled during the second map load. A temporary debugger change let that load finish. Removing it brought the crash back in the same client process; enabling it again in a new process worked.

I ran the client tests myself. The details and limitations are in ValveSoftware/Source-1-Games#8260.

@norths7ar norths7ar changed the title fix: defer match autoload until client sign-on completes Defer early match autoload to mitigate client crashes Sep 7, 2026
@SirPlease

Copy link
Copy Markdown
Owner

This is a lot of AI jargon with likely a lot of AI assessment rather than personal findings.
Regardless, the workaround is viable.

In the future it'd be preferable if you were to mention the use of AI as well as to formulate a PR along with additional comments with your own wording.

@norths7ar

Copy link
Copy Markdown
Author

That's fair. My knowledge stops at sourcemod, so I used ai to help dig into the engine side and ended up relying on it too much for the wording. I did the actual client testing myself and maybe should’ve made that clearer. I’ll keep it more in my own words next time.

eatradish added a commit to eatradish/L4D2-Competitive-Rework that referenced this pull request Sep 11, 2026
- 触发点:OnPluginStart / OnAllPluginsLoaded / OnMapStart / LGO_OnMatchModeUnloaded(+3s) /
  最后一人离开(+5s);只在没有真人连接时动手(避免重开图伤到在局玩家,即上游 PR SirPlease#1010 那个场景)
- 被卸载也能自愈:.smx 放 plugins/ 根目录,pred_unload_plugins -> sm plugins refresh 会回载;
  generalfixes.cfg 加加载行,覆盖"模式加载开头 unload_all"那条路径
- 新增钉值(思路来自 TouchMe-Inc/l4d2_config_manager 的 config_manager_addcvar):
  cfg/watchdog_pins.cfg + sm_watchdog_pin / unpin / unpin_all;模式在跑期间顶回外部改动,
  模式卸载时释放并还原
- 删掉防卸载值:pure/confogl_off.cfg 恢复标准拆卸(confogl_resetcvars + pred_unload_plugins);
  server.cfg 去掉 sb_all_bot_game 保活块(保留 hibernate=0 / mp_gamemode / sm_forcematch)
@norths7ar

Copy link
Copy Markdown
Author

I've updated the branch and shortened the write-up. @SirPlease, would you still be interested in merging this?

@SirPlease

Copy link
Copy Markdown
Owner

It currently conflicts with some changes on my local branch, which is why I've been holding off.
I did get to testing your approach and while it doesn't 100% resolve the issue (it's a band-aid after all), it does reduce the likelihood of crashes by a significant amount, so I'll be accepting this shortly as an acceptable "fix" 😄

@norths7ar

Copy link
Copy Markdown
Author

😄 thanks for testing it and letting me know!

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.

3 participants