Magic-folder status API often fails to display queued upload operations #2885
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#2885
Loading…
Reference in New Issue
Block a user
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?
While working on an application that uses the magic-folder status API (in this case, a monitor module for Gridsync that displays and updates the total progress and time remaining of an in-progress magic-folder sync operation), I've noticed that the status API will often fail to display entries for queued operations and/or drop previously-displayed entries from its output.
To demonstrate what I mean by this, I have a magic-folder already configured and a simple python script that
pprint()
s the JSON output of the magic-folder status API..To start, I create five 100M junk files inside the local magic-folder directory (by
dd
ing/dev/urandom
intofile_1
,file_2
, and so on), simulating the behavior of a user that might dump a handful of large-ish files into a magic-folder.Later, I send an authenticated POST request to magic-folder status API and get back the following output:
This is exactly the output that I'd expect to see:
file_1
is just over half-way uploaded andfile_2
throughfile_5
are sitting in thequeued
state (i.e., pending upload). If I know the filesize of each file (and, in this case, I do!) I can easily calculate and display the total progress of the overall sync operation (10.9%!) and make rough estimates as to how long the process as a whole will take based on the speed/duration of the upload as I continue to monitor it. Perfect!Moments later, however, I notice something strange: After
file_1
finishes andfile_2
begins uploading,file_3
throughfile_5
disappear from the status output altogether; I see only this:If I go by what the status API tells me alone, I might think that those files have disappeared (and if I hadn't seen the previous output, I wouldn't even know that
file_3
throughfile_5
exist!), however, a quick look into my local magic-folder directory reveals that they're still sitting there:Shortly after, I check again and see that
file_3
is now uploading.file_4
andfile_5
, however, are still absent:I wait a few moments again and then I see this:
For some reason,
file_1
throughfile_4
now have two entries each. I haven't modified these files since their creation so I'm not sure why magic-folder suddenly wants to upload them again (if that's what it's planning on doing) but I assume, for now, that they'll go away later -- maybe afterfile_5
re-appears and completes its upload..Checking later, I see that
file_5
is now back -- and the total operation progress can be calculated with confidence at 85.1%:For whatever it's worth, I see that the
queued_at
time for myfile_5
upload is earlier than that of the secondfile_1
upload and yet, despite being temporally prior, it failed to remain present when the secondfile_1
operation appeared. More interestingly, thequeued_at
value forfile_5
is the same as what it was when I originally saw it (i.e., just before it disappeared from the JSON output) leading me to believe that magic-folder "knew" about thefile_5
operation all along but, for whatever reason, stopped displaying it in the JSON output along the way.With all that being said, given this behavior, the magic-folder status API seemingly cannot be relied upon to provide accurate information regarding future/pending upload operations (while my goal of providing a single status indicator for a set of upload/download operations seemingly can't be achieved without resorting to extremely wasteful measures); without catching that brief early moment when all of the queued files are faithfully present (i.e., before they disappear from the JSON output), there appears to be no simple or direct way of knowing which files magic-folder is planning to upload until that upload actually begins.
Ideally, this would work in a more reliable fashion: when magic-folder's filesystem monitor detects a local file change, the subsequent upload operation should be added to whatever queue the status API gathers its information from and remain there indefinitely. Having entries disappear and reappear requires that any applications relying on this API perform additional and ongoing checks to assess the accuracy of the information being provided (for example, having to check and see whether
file_5
actually disappeared from the disk).Hmm, this might be some bug in the actual magic-folder queueing logic? IIRC, the status API is "just" outputting everything from the queue.
(https://github.com/tahoe-lafs/tahoe-lafs/pull/461)
this is now merged on master