Skip to content

[L4D2][Windows] Early map reload skips material queue shutdown and crashes at shaderapidx9+0x612A #8260

Open

Description

@norths7ar

Summary

My Windows L4D2 client crashes at shaderapidx9.dll+0x612A when a server reloads the map shortly after I join. The loading-start routine returns early because its loading flag is already set, skipping the call that disables queued material rendering. Map geometry loading then reaches a buffer modification path with a null D3D buffer pointer.

Calling the existing queue-disable function once before that early return allowed the second load to finish. Removing the intervention reproduced the crash in the same client process; enabling it again in a new process worked. Queued rendering resumed after both successful loads.

Test setup

Tests were performed on September 7, 2026:

  • Windows 11 Pro 26200; x86 L4D2 build 10097, Direct3D 9.
  • Ryzen 5 9600X, NVIDIA RTX 5070, driver 32.0.16.1074.
  • WSL2 Ubuntu 22.04 dedicated server; c1m1_hotel, versus, sv_pure 0, sv_forcepreload 0.
  • SourceMod with only basecommands.smx and the probe below, without Confogl or the competitive mode plugins.
  • Client: cl_forcepreload 0, mat_queue_mode -1. The observed actual queue mode was 2 during sign-on.
  • Client launch options: -insecure -condebug; server: -insecure. Debugger: x86 CDB 10.0.28000.2705.

The client still had Workshop/custom addons; a pristine-client reproduction has not been tested. The detailed traces and intervention tests used debugger breakpoints, which affect timing. Crashes also occurred before the targeted debugger tests. Results below cover this setup, not other maps or hardware.

Reproduction

  1. Start the server with the one-shot probe below loaded:
    ./srcds_run -insecure -game left4dead2 -console -usercon -port 27015 +sv_lan 0 +sv_pure 0 +mp_gamemode versus +map c1m1_hotel
  2. Start the client with the options above, set cl_forcepreload 0 and mat_queue_mode -1 in the main menu, and connect.
  3. The probe reloads the same map about 3 seconds after the first human's OnClientPutInServer. The client crashes during this second load, before its second player_connect_full.
  4. Restart the server between trials to rearm the probe. It fires only once per server run.

This happens during the initial connection and early reload; no other player is needed. The failure is timing-dependent: the tested 30-second delay completed both loads, and mat_queue_mode 0 also avoided the crash.

SourceMod reproduction plugin
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
public Plugin myinfo = {name="Join Restart Probe",author="Local diagnostic",description="One restart after first human PutInServer",version="1.0"};
bool scheduled;
public void OnPluginStart() {
    HookEvent("player_connect_full", Full, EventHookMode_Post);
    PrintToServer("[MinimalProbe] Loaded time=%.6f",GetEngineTime());
}
public void OnClientPutInServer(int client) {
    if (IsFakeClient(client) || scheduled) return;
    scheduled=true;
    PrintToServer("[MinimalProbe] PutInServer userid=%d; schedule 3 seconds time=%.6f tick=%d",GetClientUserId(client),GetEngineTime(),GetGameTickCount());
    DataPack pack; CreateDataTimer(3.0, Restart, pack);
    char map[128]; GetCurrentMap(map,sizeof(map)); pack.WriteString(map);
}
public Action Restart(Handle timer,DataPack pack) {
    char map[128]; pack.Reset(); pack.ReadString(map,sizeof(map));
    ServerCommand("sm plugins load_lock");
    PrintToServer("[MinimalProbe] ForceChangeLevel map=%s time=%.6f tick=%d",map,GetEngineTime(),GetGameTickCount());
    ForceChangeLevel(map,"Match restart");
    return Plugin_Stop;
}
public void Full(Event event,const char[] name,bool dontBroadcast) {
    PrintToServer("[MinimalProbe] connect_full userid=%d time=%.6f tick=%d",event.GetInt("userid"),GetEngineTime(),GetGameTickCount());
}
public void OnMapStart() {PrintToServer("[MinimalProbe] OnMapStart time=%.6f tick=%d",GetEngineTime(),GetGameTickCount());}
public void OnMapEnd() {PrintToServer("[MinimalProbe] OnMapEnd time=%.6f tick=%d",GetEngineTime(),GetGameTickCount());}

sm plugins load_lock prevents additional plugins from autoloading across the reload.

Failure path

Offsets below are for build 10097. Function roles were identified from disassembly, embedded diagnostics and live traces.

  1. Sign-on enables queued rendering while the loading-screen flag remains set.
  2. CClientState::SetSignonState calls the loading-start routine again. At both the state-7 and subsequent state-2 entries, the loading flag is 1 and actual/desired queue modes are 2. The guard therefore returns before the queue-disable call:
engine+0xD3B40  push ebp
engine+0xD3B41  mov ebp, esp
engine+0xD3B43  cmp byte ptr [engine+0x6037C1], 0
engine+0xD3B4A  jne engine+0xD3CA1  ; return if already loading
...
engine+0xD3B6F  push 0
engine+0xD3B71  call engine+0x18D4D0 ; disable queued material rendering
engine+0xD3B78  mov byte ptr [engine+0x6037C1], 1

The entry values were captured live; the branch outcome follows from those values and the disassembly. The flag's loading-screen role is supported by HideLoadingPlaque diagnostics and loading-started/finished events.

  1. A later scoped operation temporarily disables the queue, then restores its previous enabled state. A loading-progress EndFrame applies mode 2 before displacement geometry loads.
  2. The vertex-buffer constructor takes a CPU-backed branch without creating a D3D buffer. The displacement mesh Modify path then unconditionally dereferences that D3D pointer. The wrapper has CPU storage, but its D3D pointer is null.

A native int3 at materialsystem+0x147FF reports Called function that cannot be supported. Continuing past it reaches the access violation:

Crash registers, stack and buffer fields
Access violation - code c0000005 (first chance)
eax=00000030 ebx=00000000 ecx=00000000 edx=00000800
shaderapidx9+0x612a: mov ebx,dword ptr [ecx]  ; read at 0

Relevant stack, module-relative offsets:
shaderapidx9+0x612a
shaderapidx9+0xbc7b
engine+0xaf446
engine+0xb7506
engine+0xb94c6
engine+0xeac8f
engine+0xc59b2
engine+0x937c5

Vertex-buffer wrapper fields captured at the AV:
+0x00: 0                  (D3D buffer pointer)
+0x10: 0xAD10
+0x14: 0xAD10
+0x18: 0x39B
+0x1C: 0x30               (vertex stride)
+0x24: nonzero            (CPU backing memory)
+0x2C: 0x51               (requested vertices)

Queue-disable intervention and withdrawal

When the loading-entry flag was 1 and actual queue mode was 2, a one-shot in-memory thunk called engine+0x18D4D0(false) and returned to the original guard. It preserved registers, stack and flags, left the loading flag set, and checked that actual/desired queue modes became 0. It did not repeat loading-screen initialization. No game DLL was changed on disk.

The server still reloaded after 3 seconds and mat_queue_mode stayed at -1:

Trial Reload delay after PutInServer Result
Intervention enabled 3.029 s Second load completed; actual queue mode returned to 2
Intervention removed in the same client process 3.041 s Same entry state and original +0x612A AV reproduced
Intervention re-enabled in a new process, same account 3.000 s Second load completed; actual queue mode returned to 2
Second successful intervention trace (local timestamps)
19:10:26.xxx  LOADING_BEGIN_ENTRY: flag=1 actual=2 desired=2
19:10:26.659  INTERVENTION_RETURNED: flag=1 actual=0 desired=0 count=1
             INTERVENTION_CHECK_OK
19:10:42.138  DISPLACEMENT_LOAD_ENTRY: actual=0 desired=0, hardware context
19:10:44.387  desired queue mode -> 2
19:10:44.519  actual queue mode -> 2
19:10:44.553  server player_connect_full for the second load

These results support disabling queued rendering before the already-loading early return: the loading-screen guard skips a rendering-state transition needed by the new map load.

Related report and available evidence

This started with Confogl autoload restarting the map during connection. SirPlease/L4D2-Competitive-Rework#1010 changes that server-side timing. In the reduced reproduction here, the crash occurred after the first player_connect_full, so that event alone does not ensure a safe reload.

I ran the client tests myself; the engine analysis was ai-assisted. One full crash dump, the withdrawal minidump and detailed logs are retained locally. The relevant excerpts are included above.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions