gnoi-shutdown: use per-thread DB connections to avoid crossed DPU reads#408
Open
gpunathilell wants to merge 2 commits into
Open
gnoi-shutdown: use per-thread DB connections to avoid crossed DPU reads#408gpunathilell wants to merge 2 commits into
gpunathilell wants to merge 2 commits into
Conversation
Signed-off-by: gpunathilell <gpunathilell@nvidia.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
dgsudharsan
approved these changes
Jul 13, 2026
vvolam
requested changes
Jul 13, 2026
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
… connection test Signed-off-by: gpunathilell <gpunathilell@nvidia.com>
gpunathilell
force-pushed
the
gnoi-shutdown-per-thread-db-connections
branch
from
July 21, 2026 15:11
6740fd9 to
c6b49a9
Compare
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
vvolam
reviewed
Jul 21, 2026
| # single non-thread-safe socket, so sharing one lets | ||
| # concurrent DPU reads cross their IP/port values. | ||
| thread_config_db = daemon_base.db_connect("CONFIG_DB") | ||
| thread_state_db = daemon_base.db_connect("STATE_DB") |
Contributor
There was a problem hiding this comment.
nit (optional, non-blocking): each DPU shutdown opens two fresh redis connections here that live only for this transition. swsscommon.DBConnector has no explicit close()/disconnect(), so they're reclaimed only when
handle_and_cleanup() returns and these locals go out of scope. That's fine given how infrequently DPUs shut down(≤8 per chassis), but good to fix this issue. Otherwise the PR looks good to me
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.