nebula-python icon indicating copy to clipboard operation
nebula-python copied to clipboard

Resource release is abnormal after program running is complete.

Open yihaohao opened this issue 9 months ago • 1 comments

config = Config()
config.max_connection_pool_size = 10
connection_pool = ConnectionPool()
connection_pool.init([('x.x.x.x', 9669)], config)
session = connection_pool.get_session("root", "nebula1")
# own code......
connection_pool.close()

An exception is thrown at the end of the run.

[2025-03-03 07:15:45,911] [ WARNING] ConnectionPool.py:252 - Closing a connection that is in use Exception ignored in: <function Session.__del__ at 0xfffe11d6f7e0> Traceback (most recent call last): File "/home/HwHiAiUser/.local/lib/python3.11/site-packages/nebula3/gclient/net/Session.py", line 336, in __del__ File "/home/HwHiAiUser/.local/lib/python3.11/site-packages/nebula3/gclient/net/Session.py", line 298, in release File "/home/HwHiAiUser/.local/lib/python3.11/site-packages/nebula3/gclient/net/Connection.py", line 263, in signout File "/home/HwHiAiUser/.local/lib/python3.11/site-packages/nebula3/graph/GraphService.py", line 1603, in signout File "/home/HwHiAiUser/.local/lib/python3.11/site-packages/nebula3/graph/GraphService.py", line 1606, in send_signout AttributeError: 'NoneType' object has no attribute 'CALL' Exception ignored in: <function ConnectionPool.__del__ at 0xfffe11bf1b20> Traceback (most recent call last): File "/home/HwHiAiUser/.local/lib/python3.11/site-packages/nebula3/gclient/net/ConnectionPool.py", line 43, in __del__ File "/home/HwHiAiUser/.local/lib/python3.11/site-packages/nebula3/gclient/net/ConnectionPool.py", line 252, in close File "/usr/lib/python3.11/logging/__init__.py", line 1500, in warning File "/usr/lib/python3.11/logging/__init__.py", line 1744, in isEnabledFor TypeError: 'NoneType' object is not callable

yihaohao avatar Mar 03 '25 07:03 yihaohao

I reproduced your situation. This problem is because the session is not released when connection_pool.close() is executed. You can use session.release() to release the session or use the with code block to manage this part of the code.

I checked the example and it is indeed not given a proper description of session.release(). Do we need to add it?

Fengzdadi avatar Jun 06 '25 07:06 Fengzdadi