Skip to content

Commit 6619a51

Browse files
authored
Don't handle raw socket after it's wrapped in connection (#530)
When the connection to the server is lost during or right after sending HELLO, the driver was attempting to get the address from a closed socket which causes an OSError. There is no need to handle the raw socket after a successful handshake anyway as it will be wrapped in a BOLT connection object that already logs networks errors and takes care of the underlying socket.
1 parent cdb1e26 commit 6619a51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

neo4j/io/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
)
8686
from neo4j.routing import RoutingTable
8787

88+
8889
# Set up logger
8990
log = getLogger("neo4j")
9091

@@ -247,9 +248,8 @@ def open(cls, address, *, auth=None, timeout=None, routing_context=None, **pool_
247248

248249
try:
249250
connection.hello()
250-
except Exception as error:
251-
log.debug("[#%04X] C: <CLOSE> %s", s.getsockname()[1], str(error))
252-
_close_socket(s)
251+
except Exception:
252+
connection.close()
253253
raise
254254

255255
return connection

0 commit comments

Comments
 (0)