Skip to content

During using pool in async mode with POOL_GETMODE_TIMEDWAIT see an excess of opened and busy connects over max #390

Open
@golubovai

Description

@golubovai

Hello!
This test case can be used to clarify what is going:

async def test_5529(self):
        "5529 - ensure max limit of pool is not exceeded"
        proc_name = test_env.get_sleep_proc_name()
        async def work(pool: oracledb.AsyncConnectionPool):
            while True:
                conn = None
                try:
                    conn = await pool.acquire()
                    async with conn.cursor() as cursor:
                        await cursor.callproc(proc_name, [5])
                    break
                except Exception as e:
                    continue
                finally:
                    if conn is not None:
                        await conn.close()
                    
        pool = test_env.get_pool_async(min=0, max=2, increment=1, wait_timeout=500, getmode=oracledb.POOL_GETMODE_TIMEDWAIT)
        for _ in range(20):
            asyncio.create_task(work(pool))
        for _ in range(10):
            await asyncio.sleep(0.5)
            print(f'opened: {pool.opened} busy: {pool.busy} max: {pool.max}')
            self.assertTrue(pool.busy <= pool.max)

Metadata

Metadata

Assignees

No one assigned

    Labels

    inactiveThis was marked by stalebot as inactivequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions