Promote server
59 lines 5.4 KiB Markdown Source Rendered Raw Permalink History
---
title: "How to Find Which Plugin Is Crashing Your Server"
excerpt: "A disciplined bisection method for finding the AMXX or Metamod plugin that crashes your CS 1.6 server - reading the logs, halving plugins.ini, and confirming the culprit both ways."
category: "errors"
tags: "plugins, crash"
image: ""
read_time: "8 min read"
---
<p>The server crashes, restarts, crashes again, and you have thirty plugins. Guessing wastes an evening; bisection finds the culprit in a handful of restarts. The method is the same whether the crash is a hard segfault, a map-change abort, or a slow degradation: read what the logs already told you, then halve the plugin list until one plugin is left holding the knife.</p>

<h2>1. Read the logs before you touch anything</h2>
<p>The engine and AMXX often name the plugin for free. Look in:</p>
<pre>ls -t addons/amxmodx/logs/
cat addons/amxmodx/logs/L*.log | tail -50</pre>
<p>And the engine's own output — <code>hlds_run</code> writes a crash file:</p>
<pre>cat debug.log
ls -la core*   # a core dump, if one was written</pre>
<p>AMXX errors look like <code>Run time error 10: native error</code> or a specific plugin name with a line number. If a plugin is named right before the crash, start there — you may skip the whole bisection.</p>

<h2>2. Reproduce it reliably</h2>
<p>You cannot bisect a crash you cannot trigger. Note exactly what causes it: a specific map change, a player action, a command, a certain player count, or simply "within N minutes". A crash on <code>changelevel</code> is often a precache or delta problem; a crash on a player action points at the plugin handling that action. Write the trigger down — you will run it after every step.</p>

<h2>3. Halve the plugin list</h2>
<p>Open <code>addons/amxmodx/configs/plugins.ini</code>. Comment out the bottom half with a semicolon:</p>
<pre>; disabled for bisection
; zombie.amxx
; shop.amxx
statsx.amxx
adminmenu.amxx</pre>
<p>Restart, reproduce the trigger. If it still crashes, the culprit is in the enabled half; if it stops, it is in the disabled half. Re-enable/disable to keep halving the guilty half. With thirty plugins you reach one plugin in about five rounds. This is far faster than disabling one plugin at a time.</p>

<h2>4. Don't forget Metamod plugins and modules</h2>
<p>Not everything is in <code>plugins.ini</code>. Metamod plugins (ReAPI, some anti-cheats, custom modules) live in <code>addons/metamod/plugins.ini</code>, and AMXX modules load from <code>configs/modules.ini</code>. If halving AMXX plugins never stops the crash, bisect those lists too:</p>
<pre>meta list
amxx modules</pre>
<p>A crash that survives disabling <em>every</em> AMXX plugin is either a module, a Metamod plugin, the game DLL, or the map — which is a useful result, because it clears a whole category.</p>

<h2>5. Separate plugin crashes from engine/map crashes</h2>
<p>If the crash reproduces with a completely empty <code>plugins.ini</code>, it is not an AMXX plugin. Now the suspects are the engine, the game DLL, <code>delta.lst</code>, or a specific map. A <code>changelevel</code> crash with no plugins usually means a bad <a href="/tutorials/fix-model-overflow-precache">precache/overflow</a> or a mismatched <a href="/tutorials/install-regamedll-cs16">ReGameDLL delta.lst</a>. Test on a stock map like <code>de_dust2</code> to rule the map in or out.</p>

<h2>6. Turn on more detail before the next bisection round</h2>
<p>You want the maximum information from each crash so you need fewer rounds. Two levers help. Raise AMXX's log verbosity so runtime errors are written with a stack, and keep the engine's console output where you can read it:</p>
<pre>amx_logging 2
developer 1</pre>
<p>A JIT-related crash sometimes only reproduces with the AMXX JIT on; if a plugin crashes hard with no useful log, temporarily disabling the JIT can turn a silent segfault into a readable runtime error that names the plugin and line. Do this on a <strong>staging</strong> server, never by experimenting on the live one — the whole point is to stop crashing the box players are on. Once you have the plugin, put the settings back.</p>

<h2>Common errors</h2>
<ul>
<li><strong>Bisection points nowhere</strong> — you re-enabled the wrong half, or the crash is timing-dependent. Reproduce more carefully and keep the trigger identical each round.</li>
<li><strong>Two plugins crash only together</strong> — rare but real (a shared entity or hook conflict). If halving is inconsistent, test suspect pairs.</li>
<li><strong>Crash survives an empty plugins.ini</strong> — it is a module, Metamod plugin, game DLL, or map, not an AMXX plugin.</li>
<li><strong>Only crashes with players on</strong> — a per-client code path. Note which action precedes it; that names the subsystem.</li>
</ul>

<h2>Verification</h2>
<p>Once one plugin is isolated, prove it both ways: run the server with only that plugin disabled and confirm stability across several map changes and the original trigger, then re-enable just that plugin and confirm the crash returns.</p>
<pre>; suspected culprit isolated
; badplugin.amxx</pre>
<p>That two-way confirmation is what separates the real culprit from a coincidence. With the guilty plugin named, either update it, replace it with a maintained equivalent, or fix its source and recompile. If it turned out to be a <code>bad load</code> rather than a crash, that is a different problem — see <a href="/tutorials/fix-plugins-bad-load-after-19">the bad load fix</a>.</p>