8000 Keep concurrently appended sources when reloading by wissaaamm · Pull Request #458 · go-ini/ini · GitHub
[go: up one dir, main page]

Skip to content

Keep concurrently appended sources when reloading - #458

Open
wissaaamm wants to merge 1 commit into
go-ini:mainfrom
wissaaamm:fix/reload-concurrent-append
Open

wissaaamm wants to merge 1 commit into
go-ini:mainfrom
wissaaamm:fix/reload-concurrent-append

Conversation

@wissaaamm
Copy link
Copy Markdown

Describe the pull request

A successful Append can disappear from the live configuration when it finishes while Reload is reading. Reload snapshots the data sources before reading them, then replaces the file contents with data from that snapshot even if Append has already installed a new source.

This change checks the source count under the write lock before publishing the reloaded data. If Append added sources while the reads were in flight, Reload retries with the full list. A channel-controlled regression covers both an overwritten value and a newly added key.

Link to the issue: n/a (found while inspecting the reload and append implementation).

Verification

The regression failed against the original code and passed 30 iterations with the race detector after the fix. The offline Go 1.27 runner also passed the package build, focused vet and formatting checks. The full upstream suite could not start because Testify v1.11.1 was unavailable offline.

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code.

AI usage

OpenAI Codex identified the race, wrote the fix and regression, ran the verification, and drafted this PR.

@wissaaamm
wissaaamm requested a review from unknwon as a code owner November 30, 2026 08:41

This branch has not been deployed

No deployments
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.

1 participant

0