Skip to content

(fix) cluster: handle None control_connection_timeout in wait_for_schema_agreement#768

Open
mykaul wants to merge 1 commit intomasterfrom
fix/control-connection-none-timeout
Open

(fix) cluster: handle None control_connection_timeout in wait_for_schema_agreement#768
mykaul wants to merge 1 commit intomasterfrom
fix/control-connection-none-timeout

Conversation

@mykaul
Copy link
Copy Markdown

@mykaul mykaul commented Mar 26, 2026

Summary

  • Fix TypeError in wait_for_schema_agreement when control_connection_timeout is set to None
  • The min(self._timeout, total_timeout - elapsed) call at cluster.py:4120 raises TypeError because min() cannot compare None with a numeric value
  • Setting control_connection_timeout=None is explicitly documented as supported (meaning "no timeout"), so this is a pre-existing bug

Changes

  • cassandra/cluster.py: Guard the min() call -- when self._timeout is None, use only the remaining schema agreement wait time instead of calling min(None, remaining)
  • tests/unit/test_control_connection.py: Add test_wait_for_schema_agreement_none_timeout to verify the fix

Testing

All 23 unit tests in test_control_connection.py pass (requires running without the Cython-compiled .so to test pure Python changes):

mv cassandra/cluster.cpython-*-linux-gnu.so /tmp/
python -m pytest tests/unit/test_control_connection.py -xvs
mv /tmp/cluster.cpython-*-linux-gnu.so cassandra/

…ema_agreement

min(self._timeout, total_timeout - elapsed) raises TypeError when
control_connection_timeout is set to None, which is explicitly
documented as a supported value (meaning no timeout). Guard the
min() call so that when self._timeout is None, we use only the
remaining schema agreement wait time.
@mykaul mykaul self-assigned this Mar 26, 2026
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.

1 participant