Repository navigation
fix: claim queued telemetry files before sending them - #34
Merged
Merged
Conversation
Every Telemetry instance on a machine shares one queue folder and runs its own sender, and nothing stopped two senders from sending the same file, so events were posted once per sender that saw them. A file whose deletion failed was also sent again on every poll. A sender now holds a queued file open exclusively (FileShare.Delete on Windows, an exclusive lock elsewhere) while it sends and deletes it. Closing it without deleting returns it to the queue, including when the process dies. A file that could not be deleted after being sent stays held until its deletion succeeds. A file the process can't open for writing is skipped instead of sent. The queue moves to .uno/telemetry/outbox, which older versions of the library, that don't claim files, never look into. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rajamatt
force-pushed
the
dev/mara/telemetry-outbox-claims
branch
from
October 28, 2026 19:46
a18bf42 to
fe821bd
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- state why the generic catch clauses in TryClaim and DeleteUndeletedClaims are deliberate - dispose the test channels with using declarations - narrow the best-effort cleanup catch in the shared folder tests Co-Authored-By: Claude Opus 5.5 <[email protected]>
Holding a sent file open until its deletion succeeded only kept it from being sent again while the process lived, and kept a handle open for each such file. The file is now emptied through its claim and released: whoever finds it next quarantines it as corrupt instead of sending it. - the test restores permissions before the other storage peeks, so it checks the outcome rather than the denied write - a file the process isn't allowed to open is skipped without logging Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Narrowing them only answered the generic-catch rule: cleanup is best effort, and any accept failure means the test endpoint stopped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
rajamatt
marked this pull request as ready for review
October 28, 2026 20:44
nickrandolph
approved these changes
Oct 30, 2026
ajpinedam
approved these changes
Oct 30, 2026
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
1 of 5 tasks
opensource-fork-sync Bot
pushed a commit
to cla7aye15I4nd/opensource-unoplatform__uno
that referenced
this pull request
Oct 30, 2026
Picks up the queued-file claim fix (unoplatform/uno.devtools.telemetry#34): each sender now holds a queued telemetry file open exclusively while it sends it, so senders sharing the temp folder no longer post the same events several times. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
|
/unobot prepare-release --commit-message-pattern "ci: Set version to '{0}'" |
Contributor
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.
GitHub Issue (If applicable): unoplatform/uno-private#2462
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Every desktop
Telemetryinstance on a machine, in any process, queues events in the same folder (<temp>/.uno/telemetry) and runs its own sender. Nothing stops two senders from taking the same file:Peekonly skips files that the same instance already picked up. A file stays on disk until its sender has posted and deleted it, so every other sender that polls in that window posts it too. Idle instances poll as well, so a component that never tracks anything still re-sends everyone else's events.When a delete fails,
Deletelogs it and moves on. The same sender then picks the file up again on its next poll (1 ms later) and keeps posting it until the file is 2 hours old. On Linux,/tmpis shared between users. A user who can read another user's queue but not delete from it ends up in this loop.What is the new behavior?
FileShare.Deleteon Windows (no other open can share it),FileShare.Noneelsewhere (.NET takes an exclusive lock). No other sender, in this process or another, can open the file during that time..corruptinstead of sending it, even after the sender's process has exited.<temp>/.uno/telemetry/outbox. Older versions of the library don't claim files, and they would keep re-sending anything left in.uno/telemetry. They only look at the top level of that folder, so they never see the subfolder.Also:
Why not claim by renaming the file: on Windows,
File.Moveopens the source and renames it through that open handle. When several threads race to rename the same file, every one that opened it before the first rename succeeds. A test with 4 threads succeeded on all 4 in every one of 20,000 rounds. The exclusive open had exactly one winner in 5,000 rounds on Windows (.NET 10) and Linux (.NET 8 and 10).PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information
Tests: new
PersistenceChannelSharedFolderTestscovering:Before the fix, run against
main, 4 of these 5 tests fail. The end-to-end test counts 58 to 60 POSTs for 20 events.After the fix, all 122 unit tests pass on Windows (.NET 8) and on Linux (WSL Ubuntu 24.04, .NET 8.0.33 and .NET 10.0.10, run as a non-root user so the permission tests apply). The shared-folder tests passed 5 runs in a row on Windows.
Not tested: .NET Framework (the VSIX build uses the same Windows sharing rules) and macOS.
Limits:
FileStreamrespects it, but it is off whenDOTNET_SYSTEM_IO_DISABLEFILELOCKINGis set, when the netstandard2.0 build runs on Mono, or when the temp folder is on NFS..uno/telemetry. This version never reads or cleans that folder, so only older versions send or expire them.🤖 Generated with Claude Code