Commit cb6f862
authored
fix: add timeout and close handling to connection.ready() (#253)
* fix: add timeout and close handling to connection.ready()
If neither 'connect' nor 'error' fires while waiting in ready(),
the callback never completes, causing pool.get() and kPerformWithRetry
to hang indefinitely. This adds a timeout using the existing
connectTimeout option and also listens for 'close' events.
Signed-off-by: Tristan Burch <tristan@day.ai>
* fix: resolve ready() timeout race conditions in connection
- Use host:port in timeout message when available for consistency with socket timeout
- Destroy socket when ready() timeout fires to prevent racing socket timeout from
emitting an unhandled error event after listeners are cleaned up
- Skip timeout callback when connection is already in ERROR/CLOSED state to prevent
double-invocation when connect() throws synchronously (e.g. invalid port)
Signed-off-by: Tristan Burch <tristan@tburch.com>
Signed-off-by: Tristan Burch <tristan@day.ai>
* test: add tests for ready() timeout and close handling
Signed-off-by: Tristan Burch <tristan@day.ai>
* 'TimeoutError' is not used
Signed-off-by: Tristan Burch <tristan@day.ai>
* fix: check membershipActive in updateAssignments metadata callback
When leaveGroup() is called during the metadata-insync phase of a
rebalance, the metadata callback in #updateAssignments() continued
unconditionally and overwrote assignments. Add a #membershipActive
guard consistent with #performJoinGroup() and #performSyncGroup().
Signed-off-by: Tristan Burch <tristan@day.ai>
---------
Signed-off-by: Tristan Burch <tristan@day.ai>
Signed-off-by: Tristan Burch <tristan@tburch.com>1 parent f126625 commit cb6f862
3 files changed
Lines changed: 59 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1361 | 1361 | | |
1362 | 1362 | | |
1363 | 1363 | | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
1364 | 1369 | | |
1365 | 1370 | | |
1366 | 1371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
312 | 314 | | |
| 315 | + | |
| 316 | + | |
313 | 317 | | |
| 318 | + | |
| 319 | + | |
314 | 320 | | |
315 | 321 | | |
316 | 322 | | |
317 | 323 | | |
318 | | - | |
319 | | - | |
| 324 | + | |
320 | 325 | | |
321 | 326 | | |
322 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
323 | 349 | | |
324 | 350 | | |
| 351 | + | |
325 | 352 | | |
326 | 353 | | |
327 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
300 | 324 | | |
301 | 325 | | |
302 | 326 | | |
| |||
0 commit comments