-
Notifications
You must be signed in to change notification settings - Fork 41
Connection Receive Timeout Configuration Hint Implementation #279
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
base: main
Are you sure you want to change the base?
Conversation
transistive
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I have some minor questions that we have to resolve. Let's also ensure static analysis is happy
| */ | ||
| public function discardUnconsumedResults(): void | ||
| { | ||
| if (!$this->isOpen()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this into the same if statement.
It is worth inspecting why we have to make this check, as if the conneciton is closed, the serverstate should not be in STREAMING or TX_STREAMING state in the first place
src/BoltFactory.php
Outdated
| $config->setServerAgent($response['server']); | ||
|
|
||
| // Apply recv_timeout hint if present | ||
| if (array_key_exists('connection.recv_timeout_seconds', $response['hints'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great subtle detail that we were able to pick up using the tests!
| $this->tsxConfig->getTimeout(), | ||
| $this->isInstantTransaction ? $this->bookmarkHolder : null, // let the begin transaction pass the bookmarks if it is a managed transaction | ||
| $this->isInstantTransaction ? $this->config->getAccessMode() : null, // let the begin transaction decide if it is a managed transaction | ||
| null, // mode is never sent in RUN messages - it comes from session configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure? $this->config is a session configuration object.
| TEST_DRIVER_REPO: /opt/project | ||
| TEST_BACKEND_HOST: testkit_backend | ||
| TEST_STUB_HOST: testkit | ||
| BOLT_LISTEN_ADDR: "0.0.0.0:9001" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment where this config variable is being used?
Connection Receive Timeout Configuration Hint Implementation
BoltFactory Socket Timeout Application
Extracts connection.recv_timeout_seconds hint from server HELLO response
Applies timeout value to underlying socket connection via Connection::setTimeout()
Enables socket-level read timeouts on all authenticated connections
Timeout Exception Handling & Recovery
BoltMessage detects socket timeout exceptions and closes broken connections.
Converts timeout exceptions to Neo4jException with Neo.ClientError.Cluster.NotALeader error code
Session retry logic catches NotALeader errors and closes connection pool to force routing table refresh
Neo4jConnectionPool invalidates cached routing table, triggering fresh fetch from available servers
Implicitly marks timed-out server as unavailable and removes from routing table
Feature Declaration
GetFeatures declares support for ConfHint:connection.recv_timeout_seconds in testkit backend
Enables compliance testing against official Neo4j test suite