-
Notifications
You must be signed in to change notification settings - Fork 5k
valkey: close the socket on every fail() and mark the client disconnected before onclose runs #37993
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
Open
Open
valkey: close the socket on every fail() and mark the client disconnected before onclose runs #37993
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4d21306
valkey: close the socket on every fail() and mark the client disconne…
alii 3a0e904
Merge branch 'main' into ali/valkey-fail-recovery
alii 21be6f4
valkey: fix fail_handshake/on_data clobbering a connect() issued from…
robobun 2689715
test(valkey): assert the error code of the first connect() rejection
robobun 5fb1742
Merge remote-tracking branch 'origin/main' into ali/valkey-fail-recovery
robobun dfcee7c
Merge remote-tracking branch 'origin/main' into ali/valkey-fail-recovery
robobun 682b042
valkey: settle a reconnect whose dial fails outright, disarm the conn…
robobun 134b3dd
valkey: report a dial that fails outright from the event loop
robobun 2fcf109
valkey: fast-shutdown on close() so TLS closes synchronously too, typ…
robobun a603f2c
valkey: close outright from fail(), fast shutdown only for disconnect()
robobun 1909276
Merge remote-tracking branch 'origin/main' into ali/valkey-fail-recovery
alii de72c16
Merge remote-tracking branch 'origin/main' into ali/valkey-fail-recovery
alii 218faf0
valkey: defer the close for a TLS context that cannot be built
alii 48e3ef5
valkey: stay Connecting until a deferred no-socket close runs, pin th…
robobun 404fecd
valkey tests: cap the backpressure loop and close unix listeners in f…
alii 38efbc1
valkey tests: arm the same-tick connect() from the PING rejection ins…
robobun 890824d
ci: rerun build canceled by queue cleanup
alii 4ddfb56
Merge remote-tracking branch 'origin/main' into ali/valkey-fail-recovery
robobun c793bab
valkey tests: make the stub's listen helpers reject when the listen f…
robobun 204e8a9
ci: retrigger
robobun 000413c
valkey: run a first dial that fails outright through the deferred clo…
robobun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1906,15 +1906,12 @@ | |
| fn fail_handshake( | ||
| this: &JSValkeyClient, | ||
| _vm: &VirtualMachine, | ||
| err_value: JSValue, | ||
| ) -> JsTerminatedResult<()> { | ||
| let _exit = this.vm().enter_event_loop_scope(); | ||
| this.client_mut().flags.is_manually_closed = true; | ||
| let this_br = BackRef::new(this); | ||
| let _close = scopeguard::guard(this_br, |p| p.client_mut().close()); | ||
| narrow_terminated( | ||
| this.client_mut() | ||
| .fail_with_js_value(&this.global_object, err_value), | ||
|
Check warning on line 1914 in src/runtime/valkey_jsc/js_valkey.rs
|
||
| ) | ||
| } | ||
|
|
||
|
|
@@ -1937,10 +1934,10 @@ | |
| let _guard = this.ref_scope(); | ||
| // Ensure the socket pointer is updated. | ||
| this.client_mut().socket = Socket::SocketTcp(uws::SocketTCP::detached()); | ||
| let _defer = scopeguard::guard(BackRef::new(this), |p| { | ||
| p.client_mut().status = valkey::Status::Disconnected; | ||
| p.update_poll_ref(); | ||
| }); | ||
| // Before `on_close()`: it runs `onclose` and settles the connect() | ||
| // promise, and a connect() called from either must see Disconnected. | ||
| this.client_mut().status = valkey::Status::Disconnected; | ||
| let _defer = scopeguard::guard(BackRef::new(this), |p| p.update_poll_ref()); | ||
|
robobun marked this conversation as resolved.
|
||
|
|
||
| let _ = this.client_mut().on_close(); // TODO: properly propagate exception upwards | ||
| } | ||
|
|
@@ -1962,10 +1959,8 @@ | |
| // Ensure the socket pointer is updated. | ||
| this.client_mut().socket = Socket::SocketTcp(uws::SocketTCP::detached()); | ||
| let _guard = this.ref_scope(); | ||
| let _defer = scopeguard::guard(BackRef::new(this), |p| { | ||
| p.client_mut().status = valkey::Status::Disconnected; | ||
| p.update_poll_ref(); | ||
| }); | ||
| this.client_mut().status = valkey::Status::Disconnected; | ||
| let _defer = scopeguard::guard(BackRef::new(this), |p| p.update_poll_ref()); | ||
|
|
||
| narrow_terminated(this.client_mut().on_close()) | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.