Skip to content

Conversation

dkropachev
Copy link
Collaborator

@dkropachev dkropachev commented Jul 17, 2025

Fix: #503

This issue happens when connection is opened and closed right away.
_loop_will_run calls conn.close on it, which removes self._read_watcher from the connection and since connection stays in self._new_conns on next iteration it will pick it up and try to start self._read_watcher on it.
Solution is to remove closed connection from self._new_conns and check if self._read_watcher is not None before starting it.

Two fixes for follwing problem:

Exception ignored in: <bound method LibevLoop._loop_will_run of <cassandra.io.libevreactor.LibevLoop object at 0x7343276afc10>>
Traceback (most recent call last):
  File "/123/cassandra/io/libevreactor.py", line 197, in _loop_will_run
    conn._read_watcher.start()
AttributeError: 'NoneType' object has no attribute 'start'
  1. Check if self._read_watcher is not None before starting it
  2. Remove connection from self._new_conns when it is destroyed

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@dkropachev dkropachev requested a review from Lorak-mmk July 17, 2025 03:32
@dkropachev dkropachev self-assigned this Jul 17, 2025
Prevent following to happen:
```
  File "cassandra/io/libevreactor.py", line 197, in _loop_will_run
    conn._read_watcher.start()
AttributeError: 'NoneType' object has no attribute 'start'
```
WHen connection is destroyed it is not removed from `self._new_conns`,
which is why the following error happens:
```
  File "/123/cassandra/io/libevreactor.py", line 197, in _loop_will_run
    conn._read_watcher.start()
AttributeError: 'NoneType' object has no attribute 'start'
```
@dkropachev dkropachev force-pushed the dk/prevent-starting-null-read-watcher branch from 7103c16 to 5726b7b Compare July 17, 2025 03:33
@dkropachev dkropachev merged commit 472b679 into scylladb:master Jul 22, 2025
18 checks passed
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.

libevreactor.py: AttributeError: 'NoneType' object has no attribute 'start'
2 participants