-
Notifications
You must be signed in to change notification settings - Fork 78
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
chore: fix session pool del before lock #367
base: master
Are you sure you want to change the base?
Conversation
wey-gu
commented
Oct 22, 2024
•
edited
Loading
edited
tests/test_session_pool.py::test_session_pool_multi_thread tests/test_session_pool.py::TestSessionPoolBasic::test_pool_init /home/runner/work/nebula-python/nebula-python/.venv/lib/python3.12/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function SessionPool.__del__ at 0x7f7fff215760> Traceback (most recent call last): File "/home/runner/work/nebula-python/nebula-python/nebula3/gclient/net/SessionPool.py", line 73, in __del__ self.close() File "/home/runner/work/nebula-python/nebula-python/nebula3/gclient/net/SessionPool.py", line 329, in close with self._lock: ^^^^^^^^^^ AttributeError: 'SessionPool' object has no attribute '_lock'
0919c79 fixed the ci on py37, this should be fine as we have test coverage running over 3.7 w/o PDM already, plus PDM now is 3.8+ actually. |
@@ -52,7 +52,7 @@ jobs: | |||
strategy: | |||
max-parallel: 2 | |||
matrix: | |||
python-version: [3.7, 3.8, 3.9, '3.10', 3.11] | |||
python-version: [3.8, 3.9, '3.10', 3.11] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be fine as we have test coverage running over 3.7 w/o PDM already, plus PDM now is 3.8+ actually.
@@ -70,7 +70,8 @@ def __init__(self, username, password, space_name, addresses): | |||
self._close = False | |||
|
|||
def __del__(self): | |||
self.close() | |||
if hasattr(self, '_lock'): | |||
self.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the root cause is when init the pool if the address is invalid, would raise exception
so the object has no _lock
property.
prefer move the exception at the end of init function
and the every object has _lock
property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the current change it's also ok for me.
there's the same issue with meta client, please fix it in the same way