Describe the bug
When using "Debug Current File with Databricks Connect" on serverless compute, the debugger hangs indefinitely on the first Spark action that triggers a gRPC call (e.g., .toPandas(), .collect()). The same notebook runs to completion using "Run Current File with Databricks Connect" (no debugger).
The root cause appears to be debugpy's sys.settrace thread tracing interfering with gRPC background threads used by Spark Connect. The gRPC response handler thread deadlocks under debugpy's trace hook, so the Spark action never receives its response.
Expected behavior:
Debugging should work the same as run mode — Spark actions should complete and breakpoints should be hit without hanging.
To Reproduce
- Configure Databricks Connect with serverless compute
- Create a notebook with any Spark action (e.g.,
spark.table("x").toPandas())
- Set a breakpoint before or after the Spark action
- Use "Debug Current File with Databricks Connect"
- Execution hangs at the Spark action and never returns
System information:
- Databricks Extension: 2.10.6
- databricks-connect: 16.1
- debugpy: 1.8.20
- Python: 3.12
- OS: Windows 11 Enterprise 10.0.26200
- Compute: Serverless
- VS Code: 1.104.3
Databricks Extension Logs
sdk-and-extension-logs.json
Additional context
Attempted workarounds (none resolved the issue):
- Custom
launch.json with justMyCode: true and subProcess: false
gevent: true in launch config
- Attach mode (
debugpy.listen() + debugpy.wait_for_client()): allows debugging up to the first Spark action after attach, then hangs on the next gRPC call
Describe the bug
When using "Debug Current File with Databricks Connect" on serverless compute, the debugger hangs indefinitely on the first Spark action that triggers a gRPC call (e.g.,
.toPandas(),.collect()). The same notebook runs to completion using "Run Current File with Databricks Connect" (no debugger).The root cause appears to be debugpy's
sys.settracethread tracing interfering with gRPC background threads used by Spark Connect. The gRPC response handler thread deadlocks under debugpy's trace hook, so the Spark action never receives its response.Expected behavior:
Debugging should work the same as run mode — Spark actions should complete and breakpoints should be hit without hanging.
To Reproduce
spark.table("x").toPandas())System information:
Databricks Extension Logs
sdk-and-extension-logs.json
Additional context
Attempted workarounds (none resolved the issue):
launch.jsonwithjustMyCode: trueandsubProcess: falsegevent: truein launch configdebugpy.listen()+debugpy.wait_for_client()): allows debugging up to the first Spark action after attach, then hangs on the next gRPC call