Skip to content

Connection don't closed just after call timeout acquired #386

@golubovai

Description

@golubovai
  1. What versions are you using?
    Oracle Database 19c
>>> import sys
>>> import platform
>>>
>>> print("platform.platform:", platform.platform())
platform.platform: Windows-11-10.0.22631-SP0
>>> print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
sys.maxsize > 2**32: True
>>> print("platform.python_version:", platform.python_version())
platform.python_version: 3.12.4
>>> import oracledb
>>> print("oracledb.__version__:", oracledb.__version__)
oracledb.__version__: 2.4.1
  1. Is it an error or a hang or a crash?
    It's error.
  2. What error(s) or behavior you are seeing?
    Connections remain open in async version if we call .close() just after DPY-4024: call timeout of 60 ms exceeded acquired.
  1. Does your application call init_oracle_client()?
    No, Thin
  1. Include a runnable Python script that shows the problem.

This test case not succeded.

async def test_5345(self):
        "5345 - test connection closing just after call timeout"
        for _ in range(1, 10):
            conn: AsyncConnection = None
            try:
                conn = await test_env.get_connection_async()
                conn.autocommit = False
                conn.call_timeout = 60
                conn.action = 'test_5345'
                async with conn.cursor() as cursor:
                    await cursor.execute("begin dbms_lock.sleep(0.05); end;")
                await conn.close()
            except Exception as e:
                await conn.close()
                conn = None

        await asyncio.sleep(5)
        conn2 = await test_env.get_connection_async()
        cursor2 = conn2.cursor()
        await cursor2.execute("""select count(*) from v$session where action = :1""", ['test_5345'])
        self.assertEqual(await cursor2.fetchone(), (0,))

Create schema as it is creted in tests. Test in sync mode don't have such a error.

def test_1146(self):
        "1146 - test connection closing just after call timeout"
        for _ in range(1, 10):
            conn: oracledb.Connection = None
            try:
                conn = test_env.get_connection()
                conn.autocommit = False
                conn.call_timeout = 60
                conn.action = 'test_1146'
                with conn.cursor() as cursor:
                    cursor.execute("begin dbms_lock.sleep(0.05); end;")
                conn.close()
            except Exception as e:
                conn.close()
                conn = None
        
        conn2 = test_env.get_connection()
        cursor2 = conn2.cursor()
        cursor2.execute("""select count(*) from v$session where action = :1""", ['test_5345'])
        self.assertEqual(cursor2.fetchone(), (0,))

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions