Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 6, 2025

Conversation

robsdedude
Copy link
Member

@robsdedude robsdedude commented Feb 6, 2025

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

Copy link
Contributor

@MaxAake MaxAake left a comment

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
20 checks passed
@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