Home / Hive / Resources and memory
Hive: FAILED: Execution Error, return code 2 from TezTask or MapRedTask
FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.tez.TezTaskThe query compiled but the job it launched failed. Return code 2 means the Tez DAG or MapReduce job failed at run time. The message itself carries no cause: the reason is in the Tez or YARN task logs.
Common causes
- Tasks ran out of memory (container killed or Java heap space).How to confirm: Open the failed application in the YARN UI or run yarn logs -applicationId <id> and search for "OutOfMemoryError" or "killed".
- Bad input data: a corrupt file, wrong format or a SerDe that cannot parse a row.How to confirm: The task log shows an exception from a reader or SerDe with a file path.
- Data skew: one reducer processes most of the data and times out or runs out of memory.How to confirm: One task runs far longer than the others in the Tez or YARN UI.
How to fix it
Read the task log of the first failed attempt and fix that error; the return code only says that the job failed.
For memory failures, raise the container size and Java heap together.
| Setting | Default | Note |
|---|---|---|
hive.tez.container.size | -1 | in MB |
hive.tez.java.opts | none |
Where the message comes from
Executor.javainapache/hiveatrel/release-4.2.1- Message checked in Hive 4.2.1. The class is TezTask with the default engine and MapRedTask with hive.execution.engine=mr.
Message template in the source: FAILED: Execution Error, return code %d from %s