Skip to content

Crash Dump ​

Butler SOS can create crash dump files when it encounters unrecoverable errors. These files capture diagnostic information at the exact moment of a crash, making it easier to diagnose what went wrong.

Sensitive config fields (passwords, tokens, IPs) are never written to crash dump files, and common secret patterns in error messages are redacted automatically.

Important — always review before sharing

While Butler SOS makes every effort to exclude sensitive data from crash dumps, automated redaction cannot catch all possible formats. Error messages from third-party libraries or unexpected secret formats may contain sensitive information that is not caught by automated redaction.

Before sharing any crash dump file with anyone outside your organization — including Butler SOS support — the Qlik Sense admin must review its contents to confirm no environment-specific or sensitive information is present. Restrict access to the crash dump directory to trusted users only.

When crash dumps are created ​

SourceDescription
uncaughtExceptionA synchronous exception was not caught by any try/catch handler
unhandledRejectionA rejected Promise had no .catch() handler
logFatalButler SOS deliberately triggered a fatal error before exiting

Startup failures ​

Changed in 15.1.0

Before Butler SOS 15.1.0, a Butler SOS that could not start stopped, but reported exit code zero — a clean exit — and wrote no crash dump.

When Butler SOS cannot start, it:

  1. Exits with code 1, so restart policies and monitoring see a genuine failure.
  2. Writes a crash dump to disk recording what went wrong (unless you have disabled crash dumps — see below).
  3. Logs the error, as before.

When a program finishes, it hands the operating system a number saying how it went. Zero means "finished normally"; anything else means "something went wrong". Restart policies rely on this number to decide whether to intervene.

If Butler SOS hit an unrecoverable problem while starting — an unreadable certificate file, a port already in use, an InfluxDB it could not reach at startup, a config file it could not make sense of — it used to stop, but report zero. The consequence:

  • Docker restart: on-failure never restarted it. Docker saw a container that had completed its work and exited successfully, so it left it stopped.
  • systemd Restart=on-failure never restarted it. Same reasoning.
  • Monitoring that watched for a non-zero exit saw nothing.

Restart policies now behave the way you configured them to.

You may see a restart loop ​

If Butler SOS fails to start because of something that will not fix itself — a typo in the config file, a certificate path that does not exist, a port permanently occupied by another service — then under an automatic restart policy it will fail, restart, fail again, and keep going. A crash loop.

This is intended behaviour, not a regression. A service that visibly cannot start is far easier to notice and diagnose than one that is silently absent. The loop is the symptom surfacing, not the disease.

If you see Butler SOS restarting repeatedly:

  • Do not assume the restart policy is misconfigured. It is working; it is telling you something.
  • Read the log, or the crash dump, and find the underlying error. It will almost always be a configuration problem.
  • Fix that, and the loop stops.

If you would rather it did not loop ​

Docker's restart: on-failure accepts a maximum retry count, and systemd offers StartLimitBurst and StartLimitIntervalSec for the same purpose. Either will stop a persistent failure from restarting indefinitely while still letting a transient one recover. That is a sensible thing to configure regardless.

For a problem in the config file, Butler SOS 15.4.0 and later can also report the problem once and stay up without starting any of its services. See Staying up on an invalid config file.

Crash dump files are named with a timestamp and a counter, so successive crashes do not overwrite each other. A crash loop will therefore accumulate files — another reason to cap restart attempts, and to check the directory after resolving a startup problem.

When the crash dump cannot be written ​

If the crash dump cannot be written — a directory that does not exist, or one the Butler SOS user cannot write to — Butler SOS does not treat that as a further error. It still exits with code 1 and the error is still in the log. This matters in Docker in particular, where the container runs as a non-root user that may not be able to write to the working directory. If you want crash dumps from a container, point crashFileDirectory at a mounted volume the container user can write to.

Changed in 15.4.0

Since Butler SOS 15.4.0 the Docker image has a /nodeapp/crash_dumps folder that the container user can write to, so the default ./crash_dumps works in a container. To keep crash dumps after the container is removed, mount a volume at /nodeapp/crash_dumps. See Log files and crash dumps in the container.

With enable: false, no crash dump is written. The exit code is still 1 and the error is still logged.

What has not changed ​

  • Errors after a successful start. This is about startup failures. Once Butler SOS is up and running, a problem with a single destination — InfluxDB briefly unreachable, an MQTT broker restarting — is logged and Butler SOS keeps running.
  • Normal shutdown. Stopping Butler SOS deliberately exits with code 0.
  • Log output. Startup errors are logged as before. What changed is the exit code and the crash dump, not the logging.

Configuration Reference ​

The crashFile section is a mandatory top-level key under Butler-SOS.

yaml
Butler-SOS:
  logDirectory: ./logs

  crashFile:
    enable: true                      # Default: true
    crashFileDirectory: ./crash_dumps # Default: ./crash_dumps
    crashFileCreateJson: true         # Default: true
    crashFileCreateText: true         # Default: true
SettingDefaultDescription
enabletrueMaster switch. Set to false to disable crash dump creation entirely.
crashFileDirectory./crash_dumpsDirectory where crash files are written. Relative paths are resolved from Butler SOS's working directory; absolute paths are supported. An empty string uses the working directory.
crashFileCreateJsontrueWhen true, creates a machine-readable JSON crash dump file.
crashFileCreateTexttrueWhen true, creates a human-readable plain-text crash dump file.

Plain-text files only ​

yaml
crashFile:
  enable: true
  crashFileDirectory: ./crash_dumps
  crashFileCreateJson: false
  crashFileCreateText: true

Disabled ​

yaml
crashFile:
  enable: false
  crashFileDirectory: ./crash_dumps
  crashFileCreateJson: true
  crashFileCreateText: true

File formats ​

Filename pattern ​

Both file types use the same naming convention, which includes a timestamp, the process ID, and a per-process incrementing counter to guarantee uniqueness even when multiple crashes occur within the same millisecond:

crash_dump_<YYYYMMDD>_<HHMMSS>_<mmm>_<PID>_<counter>.<ext>
  • Timestamp is local time
  • mmm is milliseconds (3 digits, zero-padded)
  • PID is the operating system process ID
  • counter is a per-process integer starting at 1
  • Extension is .json or .txt

Example: crash_dump_20260509_143045_123_12345_1.json

Files are never overwritten — each crash produces uniquely named files. The exclusive-create flag (flag: 'wx') prevents any silent overwrites if a filename were somehow reused.

JSON format ​

json
{
  "version": "1.0",
  "timestamp": "2026-05-09T14:30:45.123Z",
  "app": {
    "name": "butler-sos",
    "version": "14.0.0"
  },
  "runtime": {
    "nodeVersion": "22.10.0",
    "platform": "darwin/arm64",
    "isSea": true
  },
  "error": {
    "type": "Error",
    "message": "Connection refused",
    "stack": "at Function.foo (src/lib/foo.js:123)\n    at Module._compile (node:internal/modules/cjs-loader:456)"
  },
  "context": {
    "exitCode": 1,
    "source": "uncaughtException"
  },
  "config": {
    "logLevel": "info",
    "fileLogging": true,
    "logDirectory": "./logs",
    "anonTelemetry": false,
    "systemInfoEnable": true,
    "userEventsEnable": true,
    "influxdbEnable": true,
    "influxdbVersion": 2,
    "prometheusEnable": false,
    "mqttEnable": false,
    "auditEventsEnable": false
  }
}

JSON field descriptions ​

FieldDescription
versionCrash dump format version (currently "1.0")
timestampISO 8601 UTC timestamp of when the dump was created
app.nameAlways "butler-sos"
app.versionButler SOS version from package.json
runtime.nodeVersionNode.js version
runtime.platformprocess.platform/process.arch (e.g. "linux/x64")
runtime.isSeatrue when running as a packaged SEA binary
error.typeError constructor name (e.g. "Error", "TypeError")
error.messageError message
error.stackSanitized stack trace — absolute paths are stripped
context.exitCodeAlways 1
context.source"uncaughtException", "unhandledRejection", or "logFatal"
configNon-sensitive configuration snapshot (log level, feature enable flags, InfluxDB version)

Plain-text format ​

====================================
BUTLER SOS CRASH REPORT
====================================
Generated: 2026-05-09T14:30:45.123Z

=== APPLICATION INFO ===
Butler SOS Version: 14.0.0
Node.js Version: 22.10.0
Platform: darwin/arm64
Executable: SEA (packaged) | Node.js

=== CRASH INFO ===
Error Type: Error
Source: uncaughtException
Exit Code: 1

=== ERROR MESSAGE ===
Connection refused

=== STACK TRACE ===
at Function.foo (src/lib/foo.js:123)
    at Module._compile (node:internal/modules/cjs-loader:456)
...

====================================
END OF CRASH REPORT
====================================

Sensitive data handling ​

Crash dumps are designed to be safe to share externally. Two layers of protection are applied:

Config fields ​

Sensitive config fields are never written to crash dump files:

CategoryExamples
IP addresses / hostnamesServer hosts, client IPs, broker hosts
CredentialsPasswords, passphrases, client cert passphrases
API keys & tokensNew Relic keys, InfluxDB tokens
Account informationAccount names, account IDs, organizations
Certificate paths & contentsclientCert, clientCertKey, clientCertCA
HTTP headersAuthorization headers
MQTT topicsBase topics
UsernamesAuth usernames
Storage bucket namesInfluxDB buckets

Only non-sensitive config fields are captured in the config section of the JSON dump (log level, file logging, feature enable flags, InfluxDB version).

Error content: best-effort redaction ​

Error messages and stack traces are included to aid debugging. Butler SOS applies best-effort redaction of common sensitive patterns found in error messages:

PatternExample inputAfter redaction
URL with embedded credentialsmqtt://admin:secret@broker.example.commqtt://[REDACTED]@broker.example.com
Authorization header tokensBearer eyJhbGci...Bearer [REDACTED]
Key-value secret pairspassword=hunter2password=[REDACTED]
JSON-style secret fields"token": "abc123""token": "[REDACTED]"

Best-effort only — restrict access and review before sharing

Redaction is best-effort only. Error messages generated by third-party libraries or unexpected secret formats may not be caught by automated redaction. Treat crash dump files as potentially sensitive — restrict access to the crashFileDirectory accordingly, and always review the contents before sharing with anyone outside your organization.

Troubleshooting ​

Where to find crash dumps ​

By default, crash dump files are created in ./crash_dumps/ relative to the directory from which Butler SOS was started. Use Butler-SOS.crashFile.crashFileDirectory to change this location.

How to interpret the contents ​

  1. Open the .txt file for a quick human-readable summary.
  2. Open the .json file for machine-readable data that can be processed by support tooling.
  3. The error.message and error.stack fields identify where the crash originated.
  4. The context.source field tells you whether the crash was caused by an uncaught exception, unhandled rejection, or explicit fatal error.
  5. The config section shows which major features were enabled at the time of the crash.

Crash dumps are not being created ​

  • Verify Butler-SOS.crashFile.enable is true.
  • Verify Butler-SOS.crashFile.crashFileCreateJson or Butler-SOS.crashFile.crashFileCreateText (or both) are true.
  • Check that Butler SOS has write permission to the crashFileDirectory.
  • If crashFileDirectory is a relative path, it is resolved from the process working directory, which may differ from the installation directory.

Released under the MIT License.