Commit a56490a
committed
Use connect timeout in Bolt and TLS handshake
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.1 parent cfbff4a commit a56490a
File tree
8 files changed
+395
-25
lines changed- driver/src
- main/java/org/neo4j/driver/internal/async
- inbound
- test/java/org/neo4j/driver
- internal/async
- inbound
- v1
- integration
8 files changed
+395
-25
lines changedLines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
82 | 101 | | |
83 | 102 | | |
84 | | - | |
85 | | - | |
| 103 | + | |
86 | 104 | | |
87 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
88 | 117 | | |
89 | 118 | | |
90 | 119 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 77 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
| 33 | + | |
29 | 34 | | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| 52 | + | |
45 | 53 | | |
| 54 | + | |
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
| |||
52 | 61 | | |
53 | 62 | | |
54 | 63 | | |
| 64 | + | |
55 | 65 | | |
56 | | - | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
60 | 70 | | |
61 | | - | |
| 71 | + | |
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
65 | 75 | | |
66 | 76 | | |
67 | | - | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
75 | 85 | | |
76 | 86 | | |
77 | 87 | | |
78 | | - | |
| 88 | + | |
79 | 89 | | |
80 | 90 | | |
81 | 91 | | |
| |||
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
88 | 114 | | |
89 | 115 | | |
90 | 116 | | |
91 | | - | |
| 117 | + | |
92 | 118 | | |
93 | 119 | | |
94 | 120 | | |
| |||
112 | 138 | | |
113 | 139 | | |
114 | 140 | | |
115 | | - | |
| 141 | + | |
116 | 142 | | |
117 | 143 | | |
118 | 144 | | |
| |||
131 | 157 | | |
132 | 158 | | |
133 | 159 | | |
134 | | - | |
| 160 | + | |
135 | 161 | | |
136 | 162 | | |
137 | | - | |
| 163 | + | |
138 | 164 | | |
139 | 165 | | |
140 | 166 | | |
| |||
151 | 177 | | |
152 | 178 | | |
153 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
154 | 215 | | |
155 | 216 | | |
156 | 217 | | |
157 | 218 | | |
158 | 219 | | |
159 | 220 | | |
160 | 221 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
164 | 230 | | |
165 | 231 | | |
0 commit comments