Skip to content

Cache negative symbol lookups#5729

Merged
leculver merged 1 commit intodotnet:mainfrom
leculver:issue_675
Feb 19, 2026
Merged

Cache negative symbol lookups#5729
leculver merged 1 commit intodotnet:mainfrom
leculver:issue_675

Conversation

@leculver
Copy link
Contributor

Fixes issue #675, but also just improves the amount of symbol lookups we do.

@leculver leculver requested a review from a team as a code owner February 18, 2026 19:22
Copilot AI review requested due to automatic review settings February 18, 2026 19:22
@leculver leculver added the bug Something isn't working label Feb 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #675 by implementing negative caching for failed symbol lookups in SOS, preventing repeated network round-trips to symbol servers when symbols are unavailable. The implementation adds a global cache that tracks module PE addresses for which symbol loading has failed, and clears the cache when the symbol path changes.

Changes:

  • Implemented negative caching using std::set<ULONG64> to track failed symbol lookups by module PE address
  • Added cache invalidation when symbol path changes (in SetSymbolServer and InitializeSymbolStoreFromSymPath)
  • Added unit tests for OpenSymbolFile to verify graceful handling of invalid data

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/SOS/Strike/symbols.h Added declaration for ClearSymbolLookupCache() function
src/SOS/Strike/symbols.cpp Implemented negative cache with g_failedSymbolLookups set, cache check logic, and partial cache population for failed portable PDB lookups
src/SOS/Strike/managedcommands.cpp Added cache clearing call in SetSymbolServer command
src/SOS/Strike/dbgengservices.cpp Added cache clearing call in InitializeSymbolStoreFromSymPath
src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/SymbolServiceTests.cs Added tests for OpenSymbolFile handling of invalid PE and PDB streams
Comments suppressed due to low confidence (1)

src/SOS/Strike/symbols.cpp:342

  • The failure of LoadSymbolsForWindowsPDB is not cached. When this Windows PDB lookup fails and the code continues to try LoadSymbolsForPortablePDB, the module address should be added to g_failedSymbolLookups to prevent repeated attempts. Otherwise, Windows PDB lookup failures will still repeatedly hit symbol servers.

Consider adding the module address to the cache when LoadSymbolsForWindowsPDB fails, similar to how it's done for LoadSymbolsForPortablePDB failures at line 379.

            hr = LoadSymbolsForWindowsPDB(pMD, moduleBase, pModuleName, FALSE);
            if (SUCCEEDED(hr))
            {
                return hr;
            }
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

max-charlamb
max-charlamb previously approved these changes Feb 19, 2026
@leculver
Copy link
Contributor Author

@max-charlamb Thanks! Can you re-approve? I had to rebase on main as it got out of date.

@max-charlamb
Copy link
Member

@max-charlamb Thanks! Can you re-approve? I had to rebase on main as it got out of date.

Yep. Thanks for this change. Should be a very positive improvement.

@leculver leculver merged commit 37dffd6 into dotnet:main Feb 19, 2026
7 of 18 checks passed
@leculver leculver deleted the issue_675 branch February 19, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants