Skip to content
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

Use connect timeout in Bolt and TLS handshake #447

Merged
merged 1 commit into from
Dec 15, 2017

Conversation

lutovich
Copy link
Contributor

Previously configured connection timeout has only been used to limit amount of time it takes to establish a TCP connection. This is not the only thing driver does to establish a logical connection. It also executes TLS handshake (if configured to use encryption) and Bolt handshake to negotiate protocol version with the database. Later two steps perform reads without any timeout.

This could be a problem when database does not respond in time. Also driver might be simply connecting to something that is not the database and never responds.

This commit makes driver use configured value of connect timeout as read timeout for TLS and Bolt handshakes. So both will not hang forever when other side does not respond. Default value of connection timeout is 5 seconds. With this commit driver will wait up to 5 seconds for TLS and Bolt handshakes. Timeout is enforced by ConnectTimeoutHandler which is added to the channel pipeline when connection is established and removed from it when Bolt handshake completes.

Previously configured connection timeout has only been used to limit
amount of time it takes to establish a TCP connection. This is not the
only thing driver does to establish a logical connection. It also
executes TLS handshake (if configured to use encryption) and Bolt
handshake to negotiate protocol version with the database. Later two
steps perform reads without any timeout.

This could be a problem when database does not respond in time. Also
driver might be simply connecting to something that is not the database
and never responds.

This commit makes driver use configured value of connect timeout as
read timeout for TLS and Bolt handshakes. So both will not hang forever
when other side does not respond. Default value of connection timeout
is 5 seconds. With this commit driver will wait up to 5 seconds for TLS
and Bolt handshakes. Timeout is enforced by `ConnectTimeoutHandler` which
is added to the channel pipeline when connection is established and
removed from it when Bolt handshake completes.
@lutovich lutovich requested a review from ali-ince December 14, 2017 13:31
Copy link
Contributor

@ali-ince ali-ince left a comment

Choose a reason for hiding this comment

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

👍

@ali-ince ali-ince merged commit 3eb4c9d into neo4j:1.5 Dec 15, 2017
@lutovich lutovich deleted the 1.5-handshake-timeout branch December 15, 2017 10:25
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