gnoi-shutdown: use per-thread DB connections to avoid crossed DPU reads#408
Open
gpunathilell wants to merge 1 commit into
Open
gnoi-shutdown: use per-thread DB connections to avoid crossed DPU reads#408gpunathilell wants to merge 1 commit into
gpunathilell wants to merge 1 commit into
Conversation
Signed-off-by: gpunathilell <gpunathilell@nvidia.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
What I did
gnoi-shutdown-daemonspawns one worker thread per DPU on shutdown, but all threads shared a single CONFIG_DB/STATE_DB redis connection created once inmain(). A redisDBConnectoris a single, non-thread-safe socket, so when multiple DPUs shut down in parallel theirhget/Tablereads interleave on the wire and replies get matched to the wrong request — producing crossed IP/port values between DPUs.This gave gnoi_client a bad target like
169.254.200.1:169.254.200.2(dpu0's IP as host, dpu1's IP in the port slot), causing:Fix
Give each per-DPU worker thread its own CONFIG_DB/STATE_DB connection so reads can never cross:
handle_and_cleanup()opens freshdb_connect("CONFIG_DB")/db_connect("STATE_DB")per thread and passes them into_handle_transition()._handle_transition()/_wait_for_gnoi_halt_in_progress()take optional per-thread connections, falling back to the shared ones for direct/unit-test callers (backward compatible).Testing
py_compileclean.169.254.200.2:50052), and fallback-to-shared preserves existing unit-test behavior.