I am running an unittest that executes a list of queries atomically (creating a new connection instance every time) through a HTTPS connection. Some function calls raises ResourceWarning: unclosed <ssl.SSLSocket .... I expect Trino to close all existing SSL sockets in conn.close() and cur.close(). I tried both context manager and explicit close calls, the result is the same.
Initially, I wanted to write an integration test method under trino-python-client/tests/integration to reproduce it but the connection to the docker container are not using SSL.
create a SSL connection to a Trino host and loop through a list of queries:
import tracemalloc
import unittest
from src.my_model import my_execute_method
class TestMyModule(unittest.TestCase):
def test_queries(self):
tracemalloc.start(25)
for q in queries:
my_execute_method(q)
my_execute_method fetches the results as explained previously.
Expected behavior
I am running an
unittest
that executes a list of queries atomically (creating a new connection instance every time) through a HTTPS connection. Some function calls raisesResourceWarning: unclosed <ssl.SSLSocket ...
. I expect Trino to close all existing SSL sockets inconn.close()
andcur.close()
. I tried both context manager and explicit close calls, the result is the same.or
Actual behavior
Receiving
ResourceWarning: unclosed <ssl.SSLSocket ...
warning duringpython -m unittest discover
.Steps To Reproduce
Initially, I wanted to write an integration test method under trino-python-client/tests/integration to reproduce it but the connection to the docker container are not using SSL.
create a SSL connection to a Trino host and loop through a list of queries:
my_execute_method fetches the results as explained previously.
Log output
I enabled
tracemalloc
and here is the output:I masked
raddr
.Operating System
macos
Trino Python client version
0.319.0
Trino Server version
380
Python version
3.10
Are you willing to submit PR?