Skip to content

Commit acd68ee

Browse files
Fixed bug that would cause connections to be marked checked out but be
unavailable for use permanently (#221).
1 parent 0e5237c commit acd68ee

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Thin Mode Changes
2020
#) Fixed bug in handling invisible columns with object type names containing
2121
``%ROWTYPE``
2222
(`issue 325 <https://github.com/oracle/python-oracledb/issues/325>`__).
23+
#) Fixed bug that would cause connections to be marked checked out but be
24+
unavailable for use permanently
25+
(`issue 221 <https://github.com/oracle/python-oracledb/issues/221>`__).
2326
#) Fixed bug that would cause an internal error to be raised when attempting
2427
to close a connection that has been forcibly closed by the database.
2528
#) Internal change: further efforts to tighten code looking for the end of a

src/oracledb/impl/thin/pool.pyx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ cdef class BaseThinPoolImpl(BasePoolImpl):
256256
Called when a new connection is created on acquire with the lock held.
257257
"""
258258
if orig_conn_impl is not None:
259-
self._busy_conn_impls.remove(orig_conn_impl)
260259
self._busy_conn_impls.append(new_conn_impl)
261260
else:
262261
new_conn_impl._is_pool_extra = True
@@ -621,7 +620,6 @@ cdef class ThinPoolImpl(BaseThinPoolImpl):
621620
temp_conn_impl = None
622621
break
623622
temp_conn_impl = <ThinConnImpl> result
624-
self._busy_conn_impls.append(temp_conn_impl)
625623
if must_reconnect:
626624
break
627625

@@ -630,9 +628,11 @@ cdef class ThinPoolImpl(BaseThinPoolImpl):
630628
if requires_ping:
631629
try:
632630
temp_conn_impl.ping()
633-
except exceptions.DatabaseError:
631+
except exceptions.Error:
634632
temp_conn_impl._force_close()
635633
if temp_conn_impl._protocol._transport is not None:
634+
with self._condition:
635+
self._busy_conn_impls.append(temp_conn_impl)
636636
return temp_conn_impl
637637

638638
# a new connection needs to be created
@@ -710,7 +710,6 @@ cdef class AsyncThinPoolImpl(BaseThinPoolImpl):
710710
temp_conn_impl = None
711711
break
712712
temp_conn_impl = <AsyncThinConnImpl> result
713-
self._busy_conn_impls.append(temp_conn_impl)
714713
if must_reconnect:
715714
break
716715

@@ -719,9 +718,11 @@ cdef class AsyncThinPoolImpl(BaseThinPoolImpl):
719718
if requires_ping:
720719
try:
721720
await temp_conn_impl.ping()
722-
except exceptions.DatabaseError:
721+
except exceptions.Error:
723722
temp_conn_impl._force_close()
724723
if temp_conn_impl._protocol._transport is not None:
724+
async with self._condition:
725+
self._busy_conn_impls.append(temp_conn_impl)
725726
return temp_conn_impl
726727

727728
# a new connection needs to be created

0 commit comments

Comments
 (0)