Skip to content

Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x1682896a0>: Failed to establish a new connection: [Errno 12] Cannot allocate memory' #507

@MonsterChenzhuo

Description

@MonsterChenzhuo

Expected behavior

Execute sql and return the result

Actual behavior

Report the following abnormality and submit the sql job repeatedly.

Steps To Reproduce

self.trino_connect = create_engine(new_url,connect_args={
"request_timeout" : 3600000.0, "max_attempts" : 1},
poolclass=NullPool
).connect()
result: ResultProxy = self.trino_connect.execute(text(statement))

Log output

4/Dec/2024 14:37:54 +0800] decorators ERROR Error running execute Traceback (most recent call last): File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) OSError: [Errno 12] Cannot allocate memory During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 716, in urlopen httplib_response = self._make_request( File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 404, in _make_request self._validate_conn(conn) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1061, in _validate_conn conn.connect() File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/connection.py", line 363, in connect self.sock = conn = self._new_conn() File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x1682896a0>: Failed to establish a new connection: [Errno 12] Cannot allocate memory During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/core/ext-py3/requests-2.27.1/requests/adapters.py", line 440, in send resp = conn.urlopen( File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/connectionpool.py", line 802, in urlopen retries = retries.increment( File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/urllib3/util/retry.py", line 594, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='203.123.85.85', port=8443): Max retries exceeded with url: /v1/statement/executing/20241224_063655_00353_mrauh/y352f33101709f8c61cbd48ce017fd90650c735dc/37 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x1682896a0>: Failed to establish a new connection: [Errno 12] Cannot allocate memory')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/libs/notebook/src/notebook/decorators.py", line 120, in wrapper return f(*args, **kwargs) File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/libs/notebook/src/notebook/api.py", line 234, in execute response = _execute_notebook(request, notebook, snippet) File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/libs/notebook/src/notebook/api.py", line 159, in _execute_notebook response['handle'] = interpreter.execute(notebook, snippet) File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/libs/notebook/src/notebook/connectors/trino.py", line 94, in execute result: ResultProxy = self.trino_connect.execute(text(statement)) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 988, in execute return meth(self, multiparams, params) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement ret = self._execute_context( File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1252, in _execute_context self._handle_dbapi_exception( File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1475, in _handle_dbapi_exception util.reraise(*exc_info) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 153, in reraise raise value File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context self.dialect.do_execute( File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/trino/sqlalchemy/dialect.py", line 370, in do_execute cursor.execute(statement, parameters) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/trino/dbapi.py", line 515, in execute self._iterator = iter(self._query.execute()) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/trino/client.py", line 821, in execute self._result.rows += self.fetch() File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/trino/client.py", line 837, in fetch response = self._request.get(self._request.next_uri) File "/Users/opay-20240095/IdeaProjects/opay-hue/build/env/lib/python3.8/site-packages/trino/client.py", line 579, in get return self._get( File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/core/ext-py3/requests-2.27.1/requests/sessions.py", line 542, in get return self.request('GET', url, **kwargs) File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/core/ext-py3/requests-2.27.1/requests/sessions.py", line 529, in request resp = self.send(prep, **send_kwargs) File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/core/ext-py3/requests-2.27.1/requests/sessions.py", line 645, in send r = adapter.send(request, **kwargs) File "/Users/opay-20240095/IdeaProjects/opay-hue/desktop/core/ext-py3/requests-2.27.1/requests/adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='203.123.85.85', port=8443): Max retries exceeded with url: /v1/statement/executing/20241224_063655_00353_mrauh/y352f33101709f8c61cbd48ce017fd90650c735dc/37 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x1682896a0>: Failed to establish a new connection: [Errno 12] Cannot allocate memory'))

Operating System

linux centos7

Trino Python client version

0.324.0

Trino Server version

latest version

Python version

3.8

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions