scylladb / scylladb/python-rs-driver

Evaluate and implement Session.close()/shutdown()

Open
#159 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6
Forks
7
Avg merge
5d 13h
Merged PRs (30d)
9

Description

Old driver: Cluster.shutdown() / Session.shutdown() is used everywhere for deterministic teardown
(test/pylib/scylla_cluster.py:722,731,967,981, test/pylib/driver_utils.py:29).

To evaluate:

  • Confirm whether we actually need this, or whether GC-based cleanup is acceptable long-term — but given how load-bearing this pattern is in the old driver's test/fixture code, it's likely genuinely useful (deterministic teardown between tests, and also this would enable properly fixing this bug: https://github.com/scylladb/python-rs-driver/issues/141).
  • If we do want it: checked the pinned scylla-rust-driver has no shutdown/close method and no Drop impl on Session either. Cleanup today relies entirely on Rust's normal drop semantics of background tasks/connections. That means this likely can't be solved purely in python-rs-driver. It probably needs an upstream feature in scylla-rust-driver first.
  • Open question to resolve: is "just drop it and rely on Drop" actually good enough once wrapped through PyO3 (async runtime + GIL details may make implicit drop-based cleanup less predictable than in pure Rust), or is an explicit close truly required?

Note: In the old driver Cluster implements the plain Python context-manager protocol:enterjust returnsself, and exitjust callsself.shutdown() (cassandra/cluster.py:1907-1911,3283-3287). This is what enables the convenient withblock usage cleanup runs automatically on block exit, even if an exception is raised inside it, with no explicittry/finally` needed at the call site.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing teardown references in test/pylib/scylla_cluster.py and test/pylib/driver_utils.py, then inspect the pinned scylla-rust-driver Session API and its cleanup behavior. Compare this with the old driver's context-manager behavior in cassandra/cluster.py and issue #141. Done means resolving whether implicit drop is sufficient and, if not, identifying the required implementation path and validating deterministic teardown.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.