Skip to content

cass_session_free waits for session close #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 7, 2025

Conversation

wprzytula
Copy link
Collaborator

This is an extracted prefix of #328 that I have no doubts about. It makes cass_session_free block until the session is closed, i.e., all running requests are completed. This is what cassandra.h, as well as the AsyncClose test, specify.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have implemented Rust unit tests for the features/changes introduced.
  • [ ] I have enabled appropriate tests in Makefile in {SCYLLA,CASSANDRA}_(NO_VALGRIND_)TEST_FILTER.
  • [ ] I added appropriate Fixes: annotations to PR description.

wprzytula added 3 commits July 6, 2025 14:51
This is a preparatory step for fixing cass_session_free in the next
commit.
Quoting `cassandra.h` documentation of `cass_session_free`:
> Frees a session instance. If the session is still connected it will
> be synchronously closed before being deallocated.

This is definitely not the case in the Rust wrapper, which simply
deallocates the session without waiting for the requests to complete.
This commit makes `cass_session_free` wait for the session to close,
satisfying the contract.
@wprzytula wprzytula requested a review from Lorak-mmk July 6, 2025 14:01
@wprzytula wprzytula self-assigned this Jul 6, 2025
@wprzytula wprzytula added the bug Something isn't working label Jul 6, 2025
@wprzytula wprzytula added this to the 0.5.1 milestone Jul 6, 2025
@wprzytula wprzytula added the P1 P1 priority item - very important label Jul 6, 2025
@wprzytula wprzytula merged commit 86af86f into scylladb:master Jul 7, 2025
11 checks passed
@wprzytula wprzytula deleted the session-free-waits-for-close branch July 7, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 P1 priority item - very important
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants