ACLClouds
ACLClouds

The process stops with code 137

Confirm an OOM shutdown, reduce memory consumed, and avoid a restart loop. It can also follow a forced stop from the panel.

Code 137 generally corresponds to a SIGKILL, often sent when the container exceeds its memory limit. It can also follow a forced stop from the panel.

Step-by-step procedure

  1. Check the context

    Look for a memory spike, Killed or a reboot right after a heavy task.

  2. Limit loads

    Reduce cache, concurrency, batch size or number of workers. Avoid loading large files entirely in RAM.

  3. Check for a leak

    Monitor if memory continually increases even without activity.

  4. Adapt the offer

    Increase the RAM only when normal and optimized consumption still exceeds the limit.

Print the memory in use (Node.js)

setInterval(() => {
  const mb = Math.round(process.memoryUsage().rss / 1048576);
  console.log('memory rss=' + mb + ' MB');
}, 60000);

Print the memory peak (Python)

import resource

peak_mb = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss // 1024
print(f"peak memory: {peak_mb} MB")

Understanding exit code 137

Code 137 is 128 + 9: the process received signal 9 (SIGKILL) and could not shut down cleanly. On ACLClouds, a bot’s memory is capped at the RAM of its plan, with no swap. When the process goes over that cap, the Linux kernel kills it at once, without giving it time to write an error: the last console line is often Killed, or nothing at all.

The console then shows the “Crashed” state, the “Last exit code” and the “Crash diagnosis” card with the reason “Out of memory”. The platform restarts the bot automatically, up to 3 starts in a row; if it goes down every time, it stays crashed until you step in. A run of 60 seconds or more resets that counter.

Measuring and reducing memory use

On the bot page, the “Memory” line shows current use against the plan limit. Note it right after startup, then again after a few hours: a value that climbs and never comes back down while the bot is idle points to a leak. To find out which part of the code is using it, write the memory to the console at regular intervals with one of the snippets below.

  • discord.js: limit the caches with makeCache and sweepers, and request only the intents you actually use.
  • discord.py: lower max_messages and pass chunk_guilds_at_startup=False if you do not need the full member list.

Frequently asked questions

What does FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory mean?

Node.js hit the limit of its JavaScript heap before the container limit; the diagnosis also reads “Out of memory” in that case. First look for what keeps growing: a cache or an array that is never emptied. You can also set the heap slightly below the plan’s RAM in the start command, for example node --max-old-space-size=256 index.js. The NODE_OPTIONS variable is reserved by the system and cannot be added in “Startup”.

Why does a Python bot show MemoryError or Killed?

MemoryError is raised by Python when an allocation fails; Killed comes from the system, which stopped the process. In both cases the bot asked for more memory than the plan provides. The usual causes: a large file read in one go, a heavy library such as pandas loaded for a single function, or a list that grows with every message.

Do I need to move to a larger plan?

Only if memory use stays close to the limit once the code has been optimised. The free plan comes with 315 MB of RAM: enough for a simple bot, not for one that caches the members of many servers or plays music in several channels at once.