Fix TLS infinite busy loop when write/read handlers are removed#3508
Open
yairgott wants to merge 4 commits intovalkey-io:unstablefrom
Open
Fix TLS infinite busy loop when write/read handlers are removed#3508yairgott wants to merge 4 commits intovalkey-io:unstablefrom
yairgott wants to merge 4 commits intovalkey-io:unstablefrom
Conversation
…lkey-io#3402) This allows setting the host and port using environment variables, which makes using valkey-cli way easier in some development environments. No need to recall the right host/port, just let your `.env` do the work. --- Built locally and tested with, ```fish VALKEY_PORT=36379 ./src/valkey-cli ``` ```console 127.0.0.1:36379> ``` And using both, ```fish VALKEYCLI_HOST=(hostname).local VALKEYCLI_PORT=36379 ./src/valkey-cli ``` ```console <HOSTNAME>.local:36379> ``` Signed-off-by: Dietrich Daroch <Dietrich@Daroch.me> Signed-off-by: Yair Gottdenker <yairg@google.com>
When a TLS connection is in a state where it's waiting for a READ during a WRITE (or vice versa), it sets internal flags. If the high-level application removes the write/read handler before the operation completes, these flags were previously left set, causing the connection to remain registered for events that would never be handled, leading to an infinite busy loop in the event loop. This commit ensures these flags are cleared when handlers are removed. Added a reproduction test in src/unit/test_tls.c. Signed-off-by: Yair Gottdenker <yairg@google.com>
When a TLS connection is in a state where it's waiting for a READ during a WRITE (or vice versa), it sets internal flags. If the high-level application removes the write/read handler before the operation completes, these flags were previously left set, causing the connection to remain registered for events that would never be handled, leading to an infinite busy loop in the event loop. This commit ensures these flags are cleared when handlers are removed. Added a reproduction test in src/unit/test_tls.c. Signed-off-by: Yair Gottdenker <yairg@google.com>
Signed-off-by: Yair Gottdenker <yairg@google.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #3508 +/- ##
============================================
- Coverage 76.38% 76.36% -0.03%
============================================
Files 159 160 +1
Lines 79809 79850 +41
============================================
+ Hits 60966 60975 +9
- Misses 18843 18875 +32
🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a TLS connection is in a state where it's waiting for a READ during a WRITE (or vice versa), it sets internal flags. If the high-level application removes the write/read handler before the operation completes, these flags were previously left set, causing the connection to remain registered for events that would never be handled, leading to an infinite busy loop in the event loop.
This commit ensures these flags are cleared when handlers are removed.
Added a reproduction test in src/unit/test_tls.c.