Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

Let It Crash vs. Try-Catch: Erlang/BEAM Supervision Trees and Java Exceptions

Erlang’s “let it crash” relies on supervisors and configured restart policies; Java try-catch transfers control to a matching handler. They solve different problems and can coexist.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Let it crash” is not a replacement for exception handling. It is shorthand for a recovery design: an Erlang/BEAM worker is allowed to terminate after an unrecoverable failure, and an OTP supervisor applies a configured policy to the failed process and, depending on that policy, its siblings. Java’s try/catch instead transfers control to a matching handler in the current thread. The mechanisms operate at different levels, and either can be part of a larger system that also uses retries, health checks, or service isolation.

How the two approaches differ

Question Erlang/BEAM and OTP Java exceptions
Failure boundary A BEAM process, a lightweight runtime entity rather than an operating-system process. A supervisor may coordinate a tree of child processes. Exception handling transfers control within a thread. If no handler is found, that thread terminates under Java’s language rules.
Handling mechanism A process exits with a reason; a monitoring supervisor applies its configured child and restart policy. A matching catch handler receives control. It can recover, translate, log, clean up, or rethrow.
Recovery scope Depending on the strategy, restart the failed child or involve other children in its supervision group. Local control flow in the current thread; restarting a service or process requires a broader application or runtime design.
Cleanup and state Restarting a worker does not preserve its in-memory state. The design must decide how state is reconstructed and whether repeating work is safe. finally and try-with-resources support cleanup. A handler does not automatically restore application invariants or undo partial work.
Repeated failures Restart intensity and period settings constrain repeated restarts; a crash loop is not restarted forever without limit. Exception handling itself does not define a retry limit or restart policy.
What the mechanism does not guarantee A supervisor cannot by itself repair bad domain state, external dependencies, data-integrity problems, or system-wide resilience. A caught exception does not by itself repair bad domain state, external dependencies, data-integrity problems, or system-wide resilience.

What “let it crash” means in Erlang/BEAM

Erlang exceptions have three classes: error, exit, and throw. A try expression can match exception classes and selected reasons. If an exception is not matched, it continues outward or reaches the process’s default handling. An exception stops evaluation in the process where it was raised.

As an Amazon Associate I earn from qualifying purchases.

“Let it crash” describes what to do when local recovery is not appropriate: allow the worker to exit rather than continue in a potentially inconsistent state, then have the supervision structure decide what happens next. It does not mean ignoring failure. Erlang code can still catch exceptions locally when handling or translating one is the right choice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How an OTP supervision tree chooses recovery

An OTP supervisor starts, stops, and monitors its child processes. The child specifications and supervisor flags define the recovery policy. OTP’s documentation describes the supervisor’s purpose as keeping child processes alive by restarting them when necessary; the supervisor starts children in specification order and terminates them in reverse order. See the OTP Design Principles: Supervisor Behaviour for the target release’s details.

Restart strategies

  • one_for_one: restart the failed child.
  • one_for_all: restart all children governed by the strategy when a child fails.
  • rest_for_one: restart the failed child and children started after it, according to the supervisor’s ordering and configuration.

These strategies make recovery a policy decision, not an automatic guarantee of reliability. Restart intensity and period settings limit how much repeated failure the supervisor tolerates. Consult the OTP documentation for the release you deploy before choosing or configuring a strategy; the right choice depends on dependencies among children.

What Java try-catch does—and does not do

Java exceptions are instances of Throwable subclasses. A try statement transfers control to a matching catch handler. The handler may recover, translate, log, clean up, or rethrow, but catching an exception does not prove that the operation succeeded or that application state is valid.

Java’s finally clause supports cleanup on normal or abrupt completion. The Java Language Specification says that when a try statement has a finally clause, another block executes regardless of whether the try block completes normally or abruptly and regardless of whether a catch clause first receives control. Try-with-resources is another language feature for resource cleanup; neither mechanism is equivalent to restarting a supervised worker. If no handler is found, the current thread terminates under the JLS rules after relevant finally processing and uncaught-exception handling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Checked and unchecked exceptions

Java requires checked exceptions to be caught or declared in a throws clause. Subclasses of RuntimeException and Error are unchecked. This distinction is a compile-time language rule; it is separate from deciding how an application recovers a failed worker, service, or process.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing a recovery boundary

The useful design question is not which language “handles errors better,” but where to contain a failure and what can safely recover from it. Use local exception handling when code can take a meaningful action—such as closing a resource, translating an error at an API boundary, or retrying a specifically safe operation. Use supervision when independently running workers need an explicit policy for termination and restart.

  • Identify what failed: an operation, a thread, a worker, a dependent group, or a remote service.
  • Determine whether continuing locally preserves invariants. If not, a handler that merely suppresses the exception may hide a worse failure.
  • Decide what state a restarted worker needs and how it obtains that state.
  • Check whether repeating the interrupted operation is safe. A restart cannot determine whether an external side effect already happened.
  • Define behavior for repeated failures, including restart limits, alerts, and what should happen when a limit is exceeded.

Java applications can use broader isolation and restart mechanisms alongside exceptions; Erlang processes can catch exceptions locally. Neither language construct addresses every failure source or guarantees system availability. The official sources describe the mechanisms, but provide no comparable measured reliability result establishing that either approach is superior.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.