Skip to content

fix: close unfetched async commands#794

Open
nanookclaw wants to merge 1 commit into
databricks:mainfrom
nanookclaw:fix/close-unfetched-async-command
Open

fix: close unfetched async commands#794
nanookclaw wants to merge 1 commit into
databricks:mainfrom
nanookclaw:fix/close-unfetched-async-command

Conversation

@nanookclaw
Copy link
Copy Markdown

Summary

Cursor.close() now frees an active async command id when no result set has been fetched yet. This covers the execute_async() followed by close() path from #791, where active_command_id is set but active_result_set is still None.

When a result set exists, close still delegates to active_result_set.close() so that path can perform its existing backend cleanup without a duplicate close_command call. The cursor clears active_command_id in a finally block either way.

Tests

  • PYTHONPATH=src uv run --with pytest --with thrift --with pandas --with lz4 --with requests --with oauthlib --with openpyxl --with urllib3 --with python-dateutil --with pyjwt --with pybreaker --python 3.12 --env-file test.env.example python -m pytest tests/unit/test_client.py -k 'close_closes_active_command_without_result_set or close_delegates_to_active_result_set_without_double_closing_command or closing_result_set_hard_closes_commands or closing_connection_closes_commands'
  • uv run --with black==22.3.0 --python 3.12 black --check src/databricks/sql/client.py tests/unit/test_client.py
  • git diff --check

Closes #791

Signed-off-by: Nanook <nanookclaw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cursor.close() leaks server-side handle for async commands that were never fetched

1 participant