On DBR 15.4 the DeadlockDetector: TASK_HANGING message usually just means Spark has noticed some very long-running tasks and is checking for deadlocks. With multiple pyfunc.spark_udf models in a streaming query the tasks often appear โstuckโ because the Python UDF is blocking (heavy model inference, external calls, or GIL contention) while CPU stays high and memory steady.
Iโd suggest:
โ checking the Structured Streaming metrics to see if the batch is still progressing,
โ taking executor thread dumps to confirm threads are blocked inside the UDF,
โ testing the pipeline with fewer models / simplified UDFs to isolate which one causes the hang,
โ making sure models are loaded once per executor and not doing network/I/O per row, and, if possible, moving to vectorised / Pandas UDFs.
If the same code works on an older LTS runtime ( try to run on 14.3 or even an older one) but hangs on 15.4, it may be a runtime regression and worth raising with Databricks Support including the job and run IDs.