Skip to content

Fix exception in bolt handshake when log level <10 - #1141

Merged
robsdedude merged 7 commits into
neo4j:5.0from
robsdedude:fix/handshake-error-low-log-level
Feb 6, 2025
Merged

robsdedude merged 7 commits into
neo4j:5.0from
robsdedude:fix/handshake-error-low-log-level

Conversation

@robsdedude

@robsdedude robsdedude commented Feb 6, 2025 •

Copy link
Copy Markdown
Member

Fixes an UnboundLocalError that gets raised during the protocol handshake if the effective log level of the logger "neo4j.io" is < 10 (strictly less than logging.DEBUG).

...
  File "<path-to-python>/site-packages/neo4j/_sync/io/_pool.py", line 408, in _acquire
    return connection_creator()
  File "<path-to-python>/site-packages/neo4j/_sync/io/_pool.py", line 230, in connection_creator
    connection = self.opener(
  File "<path-to-python>/site-packages/neo4j/_sync/io/_pool.py", line 624, in opener
    return 
Bolt.open(
  File "<path-to-python>/site-packages/neo4j/_sync/io/_bolt.py", line 369, in open
    s, protocol_version, handshake, data = BoltSocket.connect(
  File "<path-to-python>/site-packages/neo4j/_sync/io/_bolt_socket.py", line 311, in connect
    agreed_version, handshake, response = s._handshake(
  File "<path-to-python>/site-packages/neo4j/_sync/io/_bolt_socket.py", line 271, in _handshake
    return agreed_version, handshake, response
UnboundLocalError: local variable 'handshake' referenced before assignment

@MaxAake MaxAake left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@robsdedude
robsdedude enabled auto-merge (squash) February 6, 2025 15:49
@robsdedude
robsdedude merged commit 92ea0de into neo4j:5.0 Feb 6, 2025
@robsdedude
robsdedude deleted the fix/handshake-error-low-log-level branch February 6, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants