Skip to content

Commit 4d3f461

Browse files
Fixed regression when connecting to a database using listener redirects
with either a connection pool or using asyncio (#275).
1 parent 3ea70a4 commit 4d3f461

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Thin Mode Changes
1717
(`issue 276 <https://github.com/oracle/python-oracledb/issues/276>`__).
1818
#) Added support for the asynchronous context manager protocol on the
1919
AsyncCursor class as a convenience.
20+
#) Fixed regression when connecting to a database using listener redirects
21+
with either a connection pool or using asyncio
22+
(`issue 275 <https://github.com/oracle/python-oracledb/issues/275>`__).
2023
#) Fixed bug with intermittent hang on some versions of Oracle Database when
2124
using asyncio and the database raises an error and output variables are
2225
present

src/oracledb/impl/thin/protocol.pyx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,12 @@ cdef class Protocol(BaseProtocol):
304304
self._process_message(auth_message)
305305

306306
# mark protocol to indicate that connect is no longer in progress; this
307-
# allows the normal break/reset mechanism to fire
307+
# allows the normal break/reset mechanism to fire; also mark the
308+
# session as not needing to be closed since for listener redirects
309+
# the packet may indicate EOF for the initial connection that is
310+
# established
308311
conn_impl.warning = auth_message.warning
312+
self._read_buf._session_needs_to_be_closed = False
309313
self._in_connect = False
310314

311315
cdef int _connect_tcp(self, ConnectParamsImpl params,
@@ -874,9 +878,12 @@ cdef class BaseAsyncProtocol(BaseProtocol):
874878
def connection_lost(self, exc):
875879
"""
876880
Called when a connection has been lost. The presence of an exception
877-
indicates an abornmal loss of the connection.
881+
indicates an abornmal loss of the connection. If in the process of
882+
establishing a connection, losing the connection is ignored since this
883+
can happen normally when a listener redirect is encountered.
878884
"""
879-
self._transport = None
885+
if not self._in_connect:
886+
self._transport = None
880887

881888
def data_received(self, data):
882889
"""

0 commit comments

Comments
 (0)