Troubleshooting YARN, MapReduce, Hive and Spark Job Failures
Where to Look First
| Question | Tool |
|---|---|
| What state is the app in? | yarn application -status <appId>, RM UI |
| Why did it fail? | Diagnostics field in app status, then yarn logs -applicationId <appId> |
| Which container failed and where? | RM UI -> app attempt -> container links, NodeManager logs |
| Was it resource related? | NodeManager log lines about memory and container-executor exit codes |
| How did it behave over time? | MapReduce/Spark history server, counters, stages |
bash
yarn application -status application_1731700000000_0500 | grep -E "State|Diagnostics|Final-State"
yarn logs -applicationId application_1731700000000_0500 -log_files_pattern "stderr|syslog" | less
yarn applicationattempt -list application_1731700000000_0500
yarn container -list appattempt_1731700000000_0500_000001
Case 1: Application Stuck in ACCEPTED
| Cause | How to check | Fix |
|---|---|---|
| Queue is full | RM scheduler page: used capacity near max | Wait, change queue, raise capacity or user limit |
| AM resource limit reached | maximum-am-resource-percent | Raise the limit, fewer concurrent apps |
| Container bigger than any node | Request > maximum-allocation-mb | Lower request or raise max |
| No healthy NodeManagers | yarn node -list -all | Fix unhealthy nodes |
| Node label mismatch | App asks label with no matching nodes | Correct the label expression |
| User not allowed in queue | ACL / queue mapping | Fix ACLs |
Case 2: Container Killed - Exit Codes
| Code / message | Meaning | Fix |
|---|---|---|
Container killed on request. Exit code is 143 | SIGTERM: YARN killed it (memory limit, preemption, app killed) | Check NodeManager log reason line |
| Exit code 137 | SIGKILL: OOM killer or forced kill | Check dmesg for OOM, reduce container memory sum |
running beyond physical memory limits. Current usage: 4.1 GB of 4 GB | Container used too much RAM | Raise memory.mb and memoryOverhead, fix leaks |
running beyond virtual memory limits | vmem check | Disable vmem-check-enabled or raise ratio |
Exit code 1 with OutOfMemoryError: Java heap space | JVM heap too small | Raise heap (-Xmx), repartition data |
| Exit code 13 (Spark) | Application error in driver | Read driver stderr |
Exit code -100 / Container released on a *lost* node | NodeManager lost | Check node health and network |
Exit code -104 / Container preempted by scheduler | Preemption | Expected, retried; reduce over-capacity use |
Case 3: ApplicationMaster Fails
Application application_... failed 2 times due to AM Container ... exited with exitCode: 1- Look at the AM container log first (
yarn logs ... -am 1) - Typical causes: missing jar or wrong classpath, no permission on staging directory (
/user/<name>/.staging), Kerberos token problems, wrong Java version
bash
hdfs dfs -ls -d /user/alice/.staging /user/alice
hdfs dfs -chown -R alice:alice /user/alice
yarn logs -applicationId application_1731700000000_0500 -am 1 | head -80
Case 4: Slow Job
| Symptom | Likely cause | Action |
|---|---|---|
| One reducer/task far longer than others | Data skew | Salting, better partitioning, skew join settings |
| Many tasks, each tiny | Small files | Combine inputs, compact data |
| Waiting for containers | Queue limits or capacity | Look at queue utilisation |
| High spill, long shuffle | Memory or network | Raise sort buffer, compress map output |
| Executors lost repeatedly | Memory overhead or preemption | Increase overhead, adjust queue |
| Task slow on one host | Bad disk or noisy neighbour | Speculative execution, blacklist the node, fix hardware |
Case 5: Spark Specific
bash
# executor lost / FetchFailed
yarn logs -applicationId application_... | grep -E "FetchFailed|ExecutorLostFailure|OutOfMemory|Container killed"
# Spark UI (via history server): Stages tab -> look for skew in task duration, shuffle read size, spill
| Message | Meaning |
|---|---|
java.lang.OutOfMemoryError: Java heap space (executor) | Raise executor memory or reduce partition size (increase partitions) |
java.lang.OutOfMemoryError (driver) | collect() or broadcast too big. Raise spark.driver.memory, avoid collecting |
org.apache.spark.shuffle.FetchFailedException | Executor or node lost, shuffle service down, or network issue |
Job aborted due to stage failure ... Task failed 4 times | Read the first real exception, not the summary |
Py4JJavaError / Python worker crashed | Python memory (spark.executor.pyspark.memory) or code error |
Case 6: Hive Query Failures
| Error | Check |
|---|---|
Vertex failed, vertexName=Map 1 ... Container killed | Tez container memory, hive.tez.container.size |
Failed to open a session / No space left | Local disk of NodeManager, log dir |
Table not found or partitions missing | Metastore state, MSCK REPAIR TABLE |
HiveAccessControlException | Ranger policy or HDFS permissions |
Lock wait timeout / transactions stuck | SHOW TRANSACTIONS, abort aged transactions, compaction health |
| Query hangs | HiveServer2 thread dump (jstack), YARN queue full |
A Good Bug Report for Developers
- Application id, user, queue, time
- Exact error and the first stack trace in the log
- Data size and input path
- Config values (executor memory, partitions)
- What changed since last success
Educate users: A short wiki page with the 10 most common errors and fixes saves your team many tickets. Link it from the error pages and notebooks.
Conclusion
Start with application status and logs, then match the exit code, container diagnostics or Spark/Hive message to a cause: queue limits, memory, skew, small files, lost nodes or permissions. Fix and share the learning.
Quick Summary: status + logs + exit code -> cause: queue, memory, skew, nodes, perms.

