Skip to content

DPY -4011 even after setting up TLS #482

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

Open
kallass opened this issue Apr 14, 2025 · 5 comments
Open

DPY -4011 even after setting up TLS #482

kallass opened this issue Apr 14, 2025 · 5 comments
Labels
question Further information is requested

Comments

@kallass
Copy link

kallass commented Apr 14, 2025

I am getting DPY 4011 issue even after setting up TLS connection to the database. I am currently using python-oracledb=3.1.0 and it is connecting to oracle 19c. I am using it in Thin mode. We are using in a service deployed in K8s connecting to an on premise Oracle Database. Python version 3.12.
My create pool setup and parameters are as follows

MIN_POOL=1
MAX_POOL=5
INCREAMENT= 1
TIMEOUT=300
EXPIRE_TIME = 60
RETRY_COUNT=3
RETRY_DELAY=5
disable_oob=True

Is there any trace that I can setup any trace to check the cause of the issue? Are there any specific parameters to help mitigate this issues?

@kallass kallass added the question Further information is requested label Apr 14, 2025
@anthony-tuininga
Copy link
Member

Can you share the traceback? Using a standalone script that creates a standalone connection to the database will be helpful in determining the source of the issue.

@kallass
Copy link
Author

kallass commented Apr 15, 2025

I will get the traceback soon. We face the issue intermittently so I will work on getting the traceback soon.

@kallass
Copy link
Author

kallass commented Apr 15, 2025

I got a traceback from the logs for one of the services which were running. We are using SQLAlchemyORM and GraphQL

GraphQL request:4:3
3 | query MyQuery {
4 | getlref(sLRef: "1724") {
| ^
5 | partitionDate
Traceback (most recent call last):
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 146, in init
self._dbapi_connection = engine.raw_connection()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3302, in raw_connection
return self.pool.connect()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 449, in connect
return _ConnectionFairy._checkout(self)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
rec = pool._do_get()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 308, in _do_get
return self._create_connection()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 674, in init
self.__connect()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 901, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
raise exc_value.with_traceback(exc_tb)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 362, in
return lambda rec: creator_fn()
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/pool.py", line 420, in acquire
return oracledb.connect(
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/connection.py", line 1264, in connect
return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/connection.py", line 646, in init
impl = pool_impl.acquire(params_impl)
File "src/oracledb/impl/thin/pool.pyx", line 638, in oracledb.thin_impl.ThinPoolImpl.acquire
File "src/oracledb/impl/thin/pool.pyx", line 644, in oracledb.thin_impl.ThinPoolImpl.acquire
File "src/oracledb/impl/thin/pool.pyx", line 640, in oracledb.thin_impl.ThinPoolImpl.acquire
File "/opt/bitnami/python/lib/python3.9/threading.py", line 338, in wait_for
result = predicate()
File "src/oracledb/impl/thin/pool.pyx", line 964, in oracledb.thin_impl.PooledConnRequest.fulfill
File "src/oracledb/impl/thin/pool.pyx", line 896, in oracledb.thin_impl.PooledConnRequest._check_connection
File "src/oracledb/impl/thin/packet.pyx", line 661, in oracledb.thin_impl.ReadBuffer.check_control_packet
File "src/oracledb/impl/thin/transport.pyx", line 351, in oracledb.thin_impl.Transport.read_packet
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/errors.py", line 195, in _raise_err
raise error.exc_type(error) from cause
oracledb.exceptions.DatabaseError: DPY-4011: the database or network closed the connection
Help: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpy-4011

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/src/src/sobom/services/query_services.py", line 93, in get_all_so_bom_bylineref
so_line_result = await session.execute(so_line_query)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/ext/asyncio/session.py", line 461, in execute
result = await greenlet_spawn(
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 190, in greenlet_spawn
result = context.switch(args, kwargs)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2362, in execute
return self._execute_internal(
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2237, in _execute_internal
conn = self._connection_for_bind(bind)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2106, in _connection_for_bind
return trans._connection_for_bind(engine, execution_options)
File "", line 2, in _connection_for_bind
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/orm/state_changes.py", line 139, in _go
ret_value = fn(self, arg, **kw)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1189, in _connection_for_bind
conn = bind.connect()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3278, in connect
return self._connection_cls(self)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 148, in init
Connection._handle_dbapi_exception_noconnection(
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2442, in _handle_dbapi_exception_noconnection
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 146, in init
self._dbapi_connection = engine.raw_connection()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3302, in raw_connection
return self.pool.connect()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 449, in connect
return _ConnectionFairy._checkout(self)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 1263, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
rec = pool._do_get()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 308, in _do_get
return self._create_connection()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 390, in _create_connection
return _ConnectionRecord(self)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 674, in init
self.__connect()
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 901, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 146, in exit
raise exc_value.with_traceback(exc_tb)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
self.dbapi_connection = connection = pool._invoke_creator(self)
File "/opt/bitnami/python/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 362, in
return lambda rec: creator_fn()
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/pool.py", line 420, in acquire
return oracledb.connect(
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/connection.py", line 1264, in connect
return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/connection.py", line 646, in init
impl = pool_impl.acquire(params_impl)
File "src/oracledb/impl/thin/pool.pyx", line 638, in oracledb.thin_impl.ThinPoolImpl.acquire
Start Time: 2025-04-15 05:17:15
INFO: 127.0.0.
:
****** - "POST /s***** HTTP/1.1" 200 OK
File "src/oracledb/impl/thin/pool.pyx", line 644, in oracledb.thin_impl.ThinPoolImpl.acquire
File "src/oracledb/impl/thin/pool.pyx", line 640, in oracledb.thin_impl.ThinPoolImpl.acquire
File "/opt/bitnami/python/lib/python3.9/threading.py", line 338, in wait_for
result = predicate()
File "src/oracledb/impl/thin/pool.pyx", line 964, in oracledb.thin_impl.PooledConnRequest.fulfill
File "src/oracledb/impl/thin/pool.pyx", line 896, in oracledb.thin_impl.PooledConnRequest._check_connection
File "src/oracledb/impl/thin/packet.pyx", line 661, in oracledb.thin_impl.ReadBuffer.check_control_packet
File "src/oracledb/impl/thin/transport.pyx", line 351, in oracledb.thin_impl.Transport.read_packet
File "/opt/bitnami/python/lib/python3.9/site-packages/oracledb/errors.py", line 195, in _raise_err
raise error.exc_type(error) from cause
sqlalchemy.exc.DatabaseError: (oracledb.exceptions.DatabaseError) DPY-4011: the database or network closed the connection
Help: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpy-4011
(Background on this error at: https://sqlalche.me/e/20/4xp6)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/src/src/s*****/resolvers/query_resolvers.py", line 21, in get_by_ref
s_o = await get_by_ref(ref)
File "/src/src/s*****/services/query_services.py", line 129, in gget_by_ref
raise RuntimeError(f"Error in s******** resolver1: {e}") from e
RuntimeError: Error in s******** resolver1: (oracledb.exceptions.DatabaseError) DPY-4011: the database or network closed the connection
Help: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpy-4011
(Background on this error at: https://sqlalche.me/e/20/4xp6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/bitnami/python/lib/python3.9/site-packages/graphql/execution/execute.py", line 530, in await_result
return_type, field_nodes, info, path, await result
File "/opt/bitnami/python/lib/python3.9/site-packages/strawberry/schema/schema_converter.py", line 750, in _async_resolver
return await await_maybe(
File "/opt/bitnami/python/lib/python3.9/site-packages/strawberry/utils/await_maybe.py", line 12, in await_maybe
return await value
File "/src/src/s*****/resolvers/query_resolvers.py", line 25, in get_all_so_bom_bylineref
raise RuntimeError(f"Error in s****** resolver1: {e}")
RuntimeError: Error in s******** resolver1: Error in s****** resolver1: (oracledb.exceptions.DatabaseError) DPY-4011: the database or network closed the connection
Help: https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpy-4011
(Background on this error at: https://sqlalche.me/e/20/4xp6)

@cjbj
Copy link
Member

cjbj commented Apr 15, 2025

It's the server dropping the connection; do you have any DB traces? We can access them via an SR or email, if you like.

@kallass
Copy link
Author

kallass commented Apr 16, 2025

We did not have any traces in DB with this particular error. Is there any trace that we can set in the front end so that it can generate the traces in the DB?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants