Saving a runtime settings file on Windows works while another reader has it open #13
Labels
No labels
agent
api-regen
agent
architect
agent
coder
agent
console-coder
agent
docs-writer
agent
mechanic
agent
protocol-coder
agent
storage-coder
area/api
area/ci
area/console
area/dhcp
area/dns
area/docs
area/packaging
area/process
area/storage
area/windows
kind
bug
kind
chore
kind
docs
kind
epic
kind
feature
kind
performance
kind
security
kind
test
priority
high
priority
low
priority
medium
resolution
duplicate
resolution
not-a-bug
resolution
wontfix
status
blocked
status
in-progress
status
needs-decision
status
needs-design
status
ready
theme
ad-samba-dns
theme
alternatives-benchmark
theme
console-toolchain
theme
later
theme
parity-devices
theme
parity-query
theme
post-release-fixes
theme
tracker-setup
theme
valkey
theme
windows-installer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Reference
lantea-one/ninlil#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
WebhookDeliveryServiceHotReloadTests.AWriteThrough...fails on Windows with "Unable to removethe file to be replaced" from
StagedFile.Commit(
src/dotnet/src/Ninlil.Dns.Common/IO/StagedFile.cs:30-32). On Windows the commit usesFile.Replace, which fails when another handle on the target lacks delete sharing (for examplethe configuration file reloader or the test reading it). If the product's own reader can hold the
file at that moment, a settings write from the API can fail on Windows.
What changes
readers of the runtime configuration file open it with
FileShare.ReadWrite | FileShare.Delete,or retry the replace briefly on a sharing violation, keeping the ACL-preserving behaviour the
comment at
StagedFile.cs:31describes. If test-only, fix the test.Acceptance
passes on Linux.
the evidence.
Source
RP-4 report finding 3 (
WebhookDeliveryServiceHotReloadTests,StagedFile.cs:32).Done on
feature/8-windows-test-suite(99f6d568).Could a live settings write on Windows fail before the fix? Yes, briefly. A configuration provider with
reloadOnChangere-reads the runtime file shortly after every write. While its read handle is open without delete sharing,File.ReplaceinStagedFile.Commitfails. So a settings write that lands during the previous write's reload, or during an operator's quick second write, could fail. Ninlil's own readers useFile.ReadAllTextand close at once, and writers are serialised byAtomicFile.GetPathLock.Evidence on Lofnheim:
AtomicFileTests.AWriteWaitsForAReaderThatBlocksDeleteSharingAndThenReplacesTheFileholds aFileShare.ReadWritereader during the commit. It fails before the fix (Dns.Common.Tests Failed 1 of 13) and passes after.Fix: on Windows,
File.Replaceis retried on a sharing violation (HResult 0x80070020/0x80070021/0x80070497), at most 20 times 50 ms apart. The target keeps its ACL. Unix is unchanged.Results: Windows Dns.Common.Tests 356/356, Webhooks.Tests 38/38; the whole solution is green on Linux. Closes when the epic branch merges into develop.
Ghost referenced this issue2026-11-06 12:32:24 -05:00