What you will be able to do
- Match a failure symptom (task exception, out-of-memory, init failure, slow SQL, cost spike) to the place that holds its evidence
- Use the Spark UI's failed stage, task failure reasons and stage metrics to find the failing task and see whether skew or spill is involved
- Read driver stdout, stderr and log4j output, executor logs and cluster event logs, and know which access modes allow each
- Explain how cluster log delivery and init script logs work, and read cluster termination codes
- Use a query profile, system.query.history and system.lakeflow run timelines when there is no Spark UI
Key concept
Evidence lives where the failure happened — Each layer of a Databricks workload keeps its own record. Compute provisioning writes to the cluster event log, Spark execution to the Spark UI and the driver and executor logs, warehouse and serverless SQL to the query profile, and run outcomes across the account to system tables. Troubleshooting starts by working out which layer failed and opening that layer's record first.
1.Choosing the diagnostic source from the symptom
The first question is not what went wrong. It is how far the workload got before it went wrong. A job that fails in a Spark task leaves a failed stage, a task failure reason and a stack trace. A job whose cluster never started leaves none of those, because no Spark application ever ran. That cluster has no Spark UI, no driver log and no task. All you have is the cluster's event log and any init script output it delivered. A slow query on a SQL warehouse has no cluster page at all, so its record is the query profile.
The Spark UI is the record of a running Spark application. It shows which jobs ran, how long each stage took, how much data moved and where tasks failed. It is built for three symptoms: a workload slower than it used to be, a workload costing more than the data volume justifies, and failures whose error message doesn't name the cause. Everything below the Spark application, such as instance launch, networking and init scripts, is recorded elsewhere.
| Symptom | First evidence source | What to read there |
|---|---|---|
| Task throws an exception; run ends FAILED | Spark UI, failed job, then failed stage | Failure reason per task, then the stack trace in the driver log |
| Executor lost or out of memory | Compute Event log, then Spark UI Executors tab | Resize or spot-loss events; the failed executor's logs |
| Cluster never starts; no Spark UI for the run | Cluster event log and delivered init script logs | Termination code, INIT_SCRIPTS_STARTED / INIT_SCRIPTS_FINISHED, script output |
| Slow or failed SQL on a warehouse or serverless | Query profile, found through Query History | Status, error, top operators, time and memory per operator |
| Which runs failed, when, and on which compute | system.lakeflow.job_task_run_timeline | result_state, termination_code, compute_ids |
A cost spike on a cluster workload uses the same Spark UI path as a slowdown, starting at the jobs timeline. If the timeline shows failing jobs, long gaps or many small jobs, go to the page for that pattern instead of working through the stages. Cost and slowness usually share a cause, because executors that wait on one straggling task still cost money.
Checkpoint 1 of 9· Check yourself
A scheduled job run ends in failure, and the run has no Spark UI. The cluster was terminated before it reached the running state. Where should you look first to find out why?
The cluster never started, so no Spark application ran and there is no Spark UI, driver log or task to read. The only record is the cluster event log, with its termination code, and any init script output the cluster delivered. The job_task_run_timeline table records outcomes, not log text.
“Use the error code from your cluster event log to find the relevant cause and recommended fix.”Source: docs.databricks.com
Checkpoint 2 of 9· Exam question
A scheduled job cluster fails during startup, before any tasks run, and the job run shows status FAILED with no Spark UI available for that run. Where should the engineer look first to find the root cause of the failure?
Correct answer: A — The cluster's init script logs, since a failure this early with no Spark UI usually means a bootstrap or init script errored before Spark started.
- A. When a cluster fails before Spark itself comes up, there is no Spark UI to inspect, so the init script and cluster event logs are the first place to look for the bootstrap-time error that prevented the cluster from starting.
- B. The Spark UI depends on a running Spark driver to populate; if the cluster failed before Spark started, there is no Executors tab data to retain, which is consistent with the scenario stating no Spark UI is available.
- C. A query profile is generated for an executed SQL query or command on a running compute resource; a cluster that never finished starting has no query to profile, so this artifact would not exist for this failure.
- D. The job and task run system tables store run-level timing, status, and termination codes for reporting, but they do not capture the full stdout/stderr text a cluster produces during startup, which lives in the cluster's log files instead.
2.Finding the failed stage and the failing task in the Spark UI
For a task exception, the Spark UI path is short. Click the failing job in the jobs timeline and scroll down to the failed stage and its failure reason. If the stage only reports a generic error, open the stage through its description link. Further down that page, each task lists why it failed, for example a memory error. That task-level reason is the first fact to write down. The full stack trace for an exception is in the driver log, covered in the next section.
Removed executors look like failures but often aren't. Autoscaling removes executors on purpose. Spot instance losses mean the cloud provider reclaimed the VMs. Executors running out of memory is the case that is a real fault. To tell them apart, check the compute's Event log first for resize or spot-loss events. If it explains nothing, open the Spark UI Executors tab and pull the logs of the failed executors.
For a slow stage, the stage page has two checks. Spill statistics appear in the stage details at the top only when the stage spilled. Spill means Spark ran short of execution memory and wrote data to disk, and it most often happens during shuffles. Skew shows up under Summary Metrics. If the Max task duration is 50% or more above the 75th percentile, suspect skew. Streaming uses the same page. Each batch links to its job, the job links to its stages, and the task list shows which executor ran each task, along with shuffle information.
After you find the outlier task, two more views confirm what is going on. On the Executors tab, the executor that ran the task has its logs and a Thread Dump link. A thread dump is the tool for a specific hanging or slow task. From the job page, Associated SQL Query opens the SQL DAG. Clicking an operator there shows output rows, peak memory and spill size, which tells you which operator produced the oversized partition. A bigger driver does nothing for this, because the slow work runs on an executor.
Checkpoint 3 of 9· Put it in order
The jobs timeline for a cluster workload shows several removed executors. Put the investigation steps in the order the guide prescribes.
- 1.Pull the logs from the failed executors to look for a real fault such as running out of memory
- 2.Note any resize or spot-loss messages; autoscaling is expected and spot loss is the provider reclaiming VMs
- 3.If the Event log explains nothing, go back to the Spark UI and open the Executors tab
- 4.Open the compute's Event log and look for events explaining the executor loss
Removed executors are often not failures. Autoscaling removes them on purpose, and spot instances get reclaimed by the cloud provider. So the compute's Event log comes first. Only when it explains nothing do you open the Executors tab and read the failed executors' logs for a real fault such as out of memory.
“To find out why your executors are failing, first check the compute's Event log to see whether there's an explanation for the executor failures.”Source: docs.databricks.com
Checkpoint 4 of 9· Exam question
A Structured Streaming job's micro-batches have started taking roughly eight times longer than usual. In the Spark UI, the engineer opens the Stages tab for the slow batch and finds a stage with a long tail: 199 of 200 tasks finish in under 10 seconds, but one task runs for over 20 minutes and shows a much larger Shuffle Read Size than the others. Which of the following are appropriate next steps to confirm and address this using the Spark UI? (Select all that apply)(Select 3)
Correct answers: A, B, C — Open the Executors tab to check whether the executor running the slow task is under GC pauses or memory pressure that would compound the skew.; Open the associated SQL/DataFrame tab to inspect the physical plan and confirm which operator produced the oversized shuffle partition.; Enable adaptive query execution's skew join optimization, or increase spark.sql.shuffle.partitions, so the oversized partition splits across more tasks.
- A. Checking the executor running the outlier task for GC pauses or memory pressure is a standard Spark UI workflow: a struggling executor can turn ordinary skew into an extreme long tail, and this rules that factor in or out before changing the job.
- B. The physical plan in the SQL/DataFrame tab identifies exactly which shuffle-producing operator (such as a join or aggregation) created the oversized partition, which is necessary before deciding how to rewrite or reconfigure the query.
- C. Adaptive query execution's skew join handling, or a higher shuffle partition count, directly targets an oversized shuffle partition by splitting it into smaller pieces so no single task carries a disproportionate share of the data.
- D. Driver memory pressure affects planning and coordination, not the size of an individual executor task's shuffle partition, so a larger driver node would not address a single skewed reducer task.
- E. Structured Streaming micro-batches run as ordinary Spark jobs and expose the same Stages tab with per-task shuffle metrics as batch jobs, so this claim about batch-only visibility is incorrect.
- F. Speculative execution reruns slow tasks on other executors as a mitigation, but disabling it removes that safety net without doing anything to rebalance the skewed partition itself, so the underlying skew remains.
3.Driver logs, executor logs and log delivery
The driver log holds the stack trace. Direct print and log statements from notebooks, jobs and libraries go to the Spark driver logs. The compute's Driver logs tab offers them as three downloadable outputs: standard output, standard error and Log4j logs. When a streaming query never shows a Streaming tab in the Spark UI, an exception stopped it before it started. The stack trace of that exception is in the driver log. The driver log also helps when batches stay stuck in processing or failed instead of reaching Completed batches.
Executor logs are for tasks that misbehave. Start on the task details page to find which executor ran the task. Then, from the compute page, open the nodes, then the master, choose that worker and read its log4j output.
Access mode decides who can read these logs. On Standard access mode, only workspace admins can open driver logs, and executor logs are not available. On Dedicated access mode, the dedicated user or group and workspace admins can read both. A troubleshooting plan that depends on executor logs therefore needs Dedicated compute, or an admin to do the reading.
Log delivery keeps these logs after the compute is gone. You can configure a log delivery location for a compute resource, and both worker and compute logs are written there. This matters most for job clusters that terminate when the run ends. With delivery configured, the logs from a failed run are still available after its cluster has been deleted.
Checkpoint 5 of 9· Check yourself
You start a Structured Streaming query on a classic cluster, but the Spark UI never shows a Streaming tab for it. Where is the evidence that explains why?
A missing Streaming tab means an exception stopped the streaming query before it started. No batch or task ran, so there are no batch pages or executor logs to read. The stack trace of that exception is in the driver log.
“You can drill into the Driver logs to look at the stack trace of the exception.”Source: docs.databricks.com
4.Cluster event logs, init scripts and termination codes
If a job cluster fails before any task runs, look in the cluster event log first. The Spark UI has nothing to show, because Spark never started. The event log records the cluster's lifecycle, and when a cluster terminates it records an error code that maps to a cause and a recommended fix. Some failures take a while to show up. A first test compute on a newly deployed workspace can hang for 20 to 30 minutes before its event log reports a network misconfiguration.
Init script failures leave evidence in two places. The cluster event log records the INIT_SCRIPTS_STARTED and INIT_SCRIPTS_FINISHED events. INIT_SCRIPTS_FINISHED includes execution duration and is logged only for scripts that completed. These events come from one representative node, not every node. The script's own output is in the cluster logs. With log delivery configured, it is written under /<cluster-log-path>/<cluster-id>/init_scripts, in one subdirectory per container.
databricks fs ls dbfs:/Volumes/<catalog>/<schema>/<volume>/1001-234039-abcde739/init_scriptsTermination codes separate your problems from the platform's. Some codes point at configuration you control, such as a subnet without free IPs, an instance type the zone can't supply, or a network path that blocks bootstrap. Others are transient faults on the Databricks or cloud-provider side, which usually clear on retry.
| Event-log evidence | Meaning | First response |
|---|---|---|
| Instance stuck in INSTANCE_INITIALIZING past the 700-second threshold | VM bootstrap timed out (network, artifact download or provider) | Check connectivity to artifact storage and control plane, DNS, firewall rules |
| Not enough free addresses in subnet | Subnet has too few IPs for the requested instances | Different or auto availability zone, larger CIDR, clean up unused interfaces |
| CLOUD_PROVIDER_LAUNCH_FAILURE | Cloud provider failed to launch the VM | Read aws_error_message; retry, since most of these are transient |
| CLUSTER_OPERATION_TIMEOUT (SERVICE_FAULT) | Internal operation missed its deadline; not your workload | Retry; contact support with cluster ID and timestamp if it recurs |
| METASTORE_DOWN events | Metastore unreachable, for example through a web application firewall | Confirm whether a WAF such as Squid proxy sits in the path |
Checkpoint 6 of 9· Match them up
Match each piece of cluster event-log evidence from a job cluster that never started to the first response it calls for.
Tap a term, then the definition that fits it.
Termination codes tell you whether the problem is yours or the platform's. Subnet IP shortages, bootstrap timeouts and a WAF blocking the metastore are configuration you control and need fixing. CLUSTER_OPERATION_TIMEOUT is a service fault that usually clears on retry.
“This indicates a problem on the Databricks or cloud-provider side rather than a problem with your workload.”Source: docs.databricks.com
5.Query profiles when there is no Spark UI
For SQL warehouses and serverless compute, the query profile takes the place of the cluster page. The Query profile is a DAG of operators that shows time spent, rows and memory peak for each. You reach it from Query History, the SQL editor, a notebook attached to a warehouse or serverless compute, the pipeline Query History tab, or the jobs UI for runs on warehouses and serverless. To open it, you need to own the query or hold at least CAN MONITOR on the warehouse that ran it.
For a failed query, start with the query details panel. It shows the status (Queued, Running, Finished, Failed or Cancelled), the user and compute, the full statement and the wall-clock breakdown into scheduling, optimization with file pruning, and execution. The Top operators panel lists the most expensive operators. From the kebab menu, Open in Spark UI shows the same Databricks SQL query at the task level.
Here is a worked case. A warehouse query joins a 900 GB fact table to a 50 GB dimension on region_id. The profile shows the shuffle operator taking most of the wall-clock time, heavy spill to disk, and one task on that shuffle stage running far longer than its siblings. A shuffle redistributes rows across executors by key. If one key value holds most of the rows, one partition gets most of the data, and that task spills while the rest finish early. The single outlier task is what points to skew. A sort-merge join chosen because the dimension is too large to broadcast slows every task, but it does not create one straggler. A disabled disk cache or poor pruning would show up on the Scan operator, not on the shuffle.
Checkpoint 7 of 9· Check yourself
A teammate clicks a finished query in Query History on a SQL warehouse. When they click See query profile, the panel says "Query profile is not available." What explains this, and how do they get a profile?
A query answered from the query cache never executes, so it has no profile. A trivial change, such as editing or removing the LIMIT, gets past the cache, and the rerun produces a profile. Owning the query or holding CAN MONITOR on the warehouse is enough to open a profile, and warehouses have no cluster page.
“A query profile is not available for queries that run from the query cache.”Source: docs.databricks.com
Checkpoint 8 of 9· Exam question
A data engineer runs a Spark SQL query on a SQL warehouse that joins a 900 GB fact table to a 50 GB dimension table on region_id. The query profile shows an Exchange operator consuming 70% of wall-clock time, with 220 GB of spill (disk) reported and one task running far longer than the others on that shuffle stage. Which diagnosis best matches this query profile evidence?
Correct answer: A — The shuffle is partitioned on a skewed key, so most rows land on one partition and that task spills to disk while the other tasks finish quickly.
- A. A long-tailed single task combined with heavy disk spill on the Exchange operator is the classic signature of partition skew: a small number of key values receive a disproportionate share of rows, overloading one reducer while the rest sit idle. This matches both the timing and spill evidence in the scenario.
- B. A 50 GB dimension table would typically exceed the default broadcast threshold and force a shuffle join, but that alone explains a shuffle existing, not why one specific task takes far longer and spills 220 GB while its peers do not.
- C. Disk cache affects how quickly source files are re-read from storage on subsequent scans, but the query profile evidence here points to the Exchange (shuffle) operator, not to repeated table scans, so a cache configuration would not produce this pattern.
- D. A string-typed join key can prevent some pushdown optimizations, but predicate pushdown filters rows before a scan; it does not explain a shuffle stage where one task processes far more data and spills to disk than its peers.
Sources10
6.System tables: which runs failed, when, and on which compute
System tables answer questions that span many runs, which no single UI page does. The System tables (billing, compute, access, lakeflow) are account-wide Unity Catalog tables of operational history. For troubleshooting, system.lakeflow.job_task_run_timeline has one row per task run, with job_id, run_id, task_key, period_start_time and period_end_time. Its compute_ids array names the job clusters, interactive clusters or SQL warehouses the task used. That cluster ID is the link back to the cluster event log.
| termination_code | Meaning | Where to look next |
|---|---|---|
| RUN_EXECUTION_ERROR | Run completed with task failures | Spark UI failed stage, then driver log |
| CLUSTER_ERROR | Run failed due to a cluster error | Cluster event log for the ID in compute_ids |
| DRIVER_ERROR | Error communicating with the Spark driver | Driver logs and the driver thread dump |
| STORAGE_ACCESS_ERROR | Error accessing customer blob storage | Storage credentials and network path |
| WORKSPACE_RUN_LIMIT_EXCEEDED | Concurrent active run quota reached | Spread the schedule over a longer window |
These tables hold outcomes and codes. They do not hold log text. For task runs longer than an hour, result_state is filled in only on the row that represents the end of the run. To read what the code actually printed, use the driver log or the delivered cluster logs.
For SQL, system.query.history plays the same role. A FAILED execution_status comes with an error_message giving the reason. spilled_local_bytes records how much data a statement temporarily wrote to disk, so you can find queries that spill without opening each one. To go from a row to its profile, sign in to the workspace in the row's workspace_id, paste the statement_id into the Statement ID field in Query History, open the query and click See query profile. Only admins can query this table by default.
Checkpoint 9 of 9· Put it in order
A query against system.query.history turns up a FAILED statement with a high spilled_local_bytes value. You want to see its operator-level detail. Put the steps for getting from that row to the statement's query profile in order.
- 1.Click the name of the query that appears, then click See query profile
- 2.Find the row of interest and note its statement_id and workspace_id
- 3.Make sure you are signed in to the workspace that matches the row's workspace_id
- 4.Click Query History in the workspace sidebar and paste the statement_id into the Statement ID field
The system table holds outcomes and metrics such as error_message and spilled_local_bytes, but not the operator DAG. The statement_id links a row to its entry in Query History. That entry exists only in the workspace that ran the statement, so you sign in there first, search by statement_id, and then open the profile.
“In the Statement ID field, paste the statement_id on the record.”Source: docs.databricks.com
Sources
(12)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“The Spark UI shows what the cluster actually did”
↩︎ Choosing the diagnostic source from the symptom“Jobs or executors fail, and the error message doesn't identify the cause.”
↩︎ Choosing the diagnostic source from the symptom“A workload costs more than expected for the amount of data it processes.”
↩︎ Choosing the diagnostic source from the symptom - 2.https://docs.databricks.com/aws/en/init-scripts/logsOfficial docs
“Init script start and finish events are captured in cluster event logs. Details are captured in cluster logs.”
↩︎ Choosing the diagnostic source from the symptom“Cluster event logs do not log init script events for each cluster node; only one node is selected to represent them all.”
↩︎ Cluster event logs, init scripts and termination codes“the init script logs are written to /<cluster-log-path>/<cluster-id>/init_scripts”
↩︎ Cluster event logs, init scripts and termination codes - 3.
“If you see any failing jobs, click them to open their pages.”
↩︎ Finding the failed stage and the failing task in the Spark UI“If you scroll down on this page, you see why each task failed.”
↩︎ Finding the failed stage and the failing task in the Spark UI“first check the compute's Event log to see whether there's an explanation for the executor failures”
↩︎ Finding the failed stage and the failing task in the Spark UI“Autoscaling: In this case it's expected and not an error.”
↩︎ Exam trap 4“To find out why your executors are failing, first check the compute's Event log to see whether there's an explanation for the executor failures.”
↩︎ Checkpoint - 4.
“If the Max duration exceeds the 75th percentile by 50% or more, the stage might have skew.”
↩︎ Finding the failed stage and the failing task in the Spark UI“Spill is most common during data shuffling.”
↩︎ Finding the failed stage and the failing task in the Spark UI“Broadcast joins are never skew-optimized”
↩︎ Finding the failed stage and the failing task in the Spark UI“Set spark.sql.shuffle.partitions=auto so that Spark picks the number of shuffle partitions”
↩︎ Finding the failed stage and the failing task in the Spark UI“Skew happens when one or a few tasks take much longer than the rest.”
↩︎ Prediction - 5.
“Thread dumps are useful in debugging a specific hanging or slow-running task.”
↩︎ Finding the failed stage and the failing task in the Spark UI“where they were executed (on which executors) and shuffle information”
↩︎ Finding the failed stage and the failing task in the Spark UI“You can drill into the Driver logs to look at the stack trace of the exception.”
↩︎ Driver logs, executor logs and log delivery“You can choose the worker where the suspicious task was run and then get to the log4j output.”
↩︎ Driver logs, executor logs and log delivery“Executor logs are not available for compute with Standard access mode.”
↩︎ Driver logs, executor logs and log delivery“For compute with Standard access mode, only workspace admins can access driver logs.”
↩︎ Exam trap 1 - 6.https://docs.databricks.com/aws/en/optimizations/spark-ui-guide/slow-spark-stage-low-ioOfficial docs
“Click an operator to see metrics such as output rows, peak memory, and spill size.”
↩︎ Finding the failed stage and the failing task in the Spark UI - 7.
“The direct print and log statements from your notebooks, jobs, and libraries go to the Spark driver logs.”
↩︎ Driver logs, executor logs and log delivery“Both worker and compute logs are delivered to the location you specify.”
↩︎ Driver logs, executor logs and log delivery - 8.
“Use the error code from your cluster event log to find the relevant cause and recommended fix.”
↩︎ Cluster event logs, init scripts and termination codes“The bootstrap timeout is 700 seconds.”
↩︎ Cluster event logs, init scripts and termination codes“This indicates a problem on the Databricks or cloud-provider side rather than a problem with your workload.”
↩︎ Cluster event logs, init scripts and termination codes“Use the error code from your cluster event log to find the relevant cause and recommended fix.”
↩︎ Key concept“Use the error code from your cluster event log to find the relevant cause and recommended fix.”
↩︎ Checkpoint - 9.
“After approximately 20-30 minutes, check your compute event log.”
↩︎ Cluster event logs, init scripts and termination codes - 10.
“you must have at least CAN MONITOR permission on the SQL warehouse that executed the query”
↩︎ Query profiles when there is no Spark UI“You can access query profiles for jobs run on SQL warehouses and serverless compute.”
↩︎ Query profiles when there is no Spark UI“Shuffle operations are expensive with regard to resources because they move data between executors on the cluster.”
↩︎ Query profiles when there is no Spark UI“Click the kebab menu near the top of the page, then click Open in Spark UI.”
↩︎ Query profiles when there is no Spark UI“A query profile is not available for queries that run from the query cache.”
↩︎ Query profiles when there is no Spark UI“A query profile is not available for queries that run from the query cache.”
↩︎ Exam trap 3 - 11.
“The compute_ids array contains IDs of job clusters, interactive clusters, and SQL warehouses used by the job task”
↩︎ System tables: which runs failed, when, and on which compute“The run failed due to a cluster error.”
↩︎ System tables: which runs failed, when, and on which compute“The run was completed with task failures.”
↩︎ System tables: which runs failed, when, and on which compute“The compute_ids array contains IDs of job clusters, interactive clusters, and SQL warehouses used by the job task”
↩︎ Exam trap 2 - 12.
“FAILED: execution failed with the reason for failure described in the accompanying error message”
↩︎ System tables: which runs failed, when, and on which compute“In the Statement ID field, paste the statement_id on the record.”
↩︎ System tables: which runs failed, when, and on which compute“Size of data, in bytes, temporarily written to disk while executing the statement.”
↩︎ System tables: which runs failed, when, and on which compute