Skip to content

Handle the race in config file registry entry #1210

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

Merged
merged 1 commit into from
Jun 17, 2025
Merged

Handle the race in config file registry entry #1210

merged 1 commit into from
Jun 17, 2025

Conversation

sheetalkamat
Copy link
Member

Fixes #1194

@Copilot Copilot AI review requested due to automatic review settings June 17, 2025 18:33
Copy link
Contributor

@Copilot 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

Implements finer-grained locking on ConfigFileEntry to eliminate a race and reduce lock contention when reloading configs.

  • Switch from sync.Mutex to sync.RWMutex and use RLock in getConfig
  • Refactor onConfigChange to clone key sets under lock and process outside the critical section
  • Apply the same lock‐scope reduction in tryInvokeWildCardDirectories using maps.Clone
Comments suppressed due to low confidence (2)

internal/project/configfileregistry.go:118

  • Consider adding tests to verify that concurrent calls to getConfig, onConfigChange, and tryInvokeWildCardDirectories behave correctly under the new RWMutex scheme.
		entry.mu.RLock()

internal/project/configfileregistry.go:220

  • The original implementation handled and returned after the first matching project; this loop now processes all matching projects—verify that this change in behavior is intended.
	for project := range projects {

@jakebailey jakebailey added this pull request to the merge queue Jun 17, 2025
Merged via the queue into main with commit 212b45a Jun 17, 2025
22 checks passed
@jakebailey jakebailey deleted the configRace branch June 17, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data race in default project finder
2 participants