Open rsanden opened 4 years ago
I reverted to c07fe0e65ccd0e13e6ebcacae8eb0521c9a16209 and the sync succeeds. I see many errors like this:
[2020-01-22 17:22:51,538]:ERROR:ankisyncd:Error when removing file '20180227134711_22634.mp3' from media dir: [Errno 2] No such file or directory: '/home/anki/src/anki-sync-server/collections/yq-class-Z1/collection.media/20180227134711_22634.mp3'
[2020-01-22 17:22:51,538]:ERROR:ankisyncd:Error when removing file '20180227150048_13153.mp3' from media dir: [Errno 2] No such file or directory: '/home/anki/src/anki-sync-server/collections/yq-class-Z1/collection.media/20180227150048_13153.mp3'
[2020-01-22 17:22:51,538]:ERROR:ankisyncd:Error when removing file '20180302093823_10153.mp3' from media dir: [Errno 2] No such file or directory: '/home/anki/src/anki-sync-server/collections/yq-class-Z1/collection.media/20180302093823_10153.mp3'
but everything works afterward.
(I would normally scrub log data, but there's nothing confidential here.)
The successful sync on c07fe0e65ccd0e13e6ebcacae8eb0521c9a16209 causes the sync on 3b8fe9e7f346cfb749bb7b045212d1e4ff2410ed to succeed afterward:
[2020-01-22 17:45:51,816]:INFO:ankisyncd.http:127.0.0.1 "POST /msync/mediaChanges HTTP/1.0" 200 349
[2020-01-22 17:45:51,887]:INFO:ankisyncd.CollectionThread[yq-class-Z1]:Running mediaChanges(*[], **{'lastUsn': 1343})
[2020-01-22 17:45:51,888]:INFO:ankisyncd.http:127.0.0.1 "POST /msync/mediaChanges HTTP/1.0" 200 284
[2020-01-22 17:45:51,956]:INFO:ankisyncd.CollectionThread[yq-class-Z1]:Running mediaChanges(*[], **{'lastUsn': 1344})
[2020-01-22 17:45:51,957]:INFO:ankisyncd.http:127.0.0.1 "POST /msync/mediaChanges HTTP/1.0" 200 218
[2020-01-22 17:45:52,034]:INFO:ankisyncd.CollectionThread[yq-class-Z1]:Running mediaChanges(*[], **{'lastUsn': 1345})
[2020-01-22 17:45:52,035]:INFO:ankisyncd.http:127.0.0.1 "POST /msync/mediaChanges HTTP/1.0" 200 152
[2020-01-22 17:45:52,107]:INFO:ankisyncd.CollectionThread[yq-class-Z1]:Running mediaChanges(*[], **{'lastUsn': 1346})
[2020-01-22 17:45:52,108]:INFO:ankisyncd.http:127.0.0.1 "POST /msync/mediaChanges HTTP/1.0" 200 88
[2020-01-22 17:45:52,171]:INFO:ankisyncd.CollectionThread[yq-class-Z1]:Running mediaChanges(*[], **{'lastUsn': 1347})
[2020-01-22 17:45:52,172]:INFO:ankisyncd.http:127.0.0.1 "POST /msync/mediaChanges HTTP/1.0" 200 23
[2020-01-22 17:45:52,221]:INFO:ankisyncd.CollectionThread[yq-class-Z1]:Running mediaSanity(*[], **{'local': 1347})
[2020-01-22 17:45:52,222]:INFO:ankisyncd.http:127.0.0.1 "POST /msync/mediaSanity HTTP/1.0" 200 25
I found out how to reproduce this.
collections.media
(ln /path/to/media/* $HOME/.local/share/Anki2/yq-class-Z1/collection.media/
).Tools -> Check Media -> Delete unused Files
Those deleted files don't exist on the server, but the Anki client doesn't know that, so it requests that they be removed. I think the issue is that the server isn't ignoring those nonexistent files and instead treats their nonexistence as a problem.
Because I am able to reproduce the problem, I was able to step through and confirm that the problem was introduced in 10f47611bf829d9e081a1213f89bbf4b25b8d59a:
10f47611bf829d9e081a1213f89bbf4b25b8d59a : AssertionError ac1920d0786725b3e6a3f23b52cd986ca6b13c7b : OK
This issue is not urgent for me. I am running on c07fe0e65ccd0e13e6ebcacae8eb0521c9a16209 (2.1.0
) in the meantime -- I just hope the bug report is useful.
@rsanden I just ran into this error as well. I tried to upload a collection to an AWS Lightsail instance. What's odd though is that I haven't removed extra media for a long time, and it wasn't until I uploaded my collection to a new server when the assertion error happened.
The move to https is making my AnkiDroid break so I'm setting up an https capable server (another writeup on that to come).
I checked my media and it seems to be uploading okay now, though.
I am operating on 3b8fe9e7f346cfb749bb7b045212d1e4ff2410ed
I encountered an AssertionError while attempting to push some media changes from Anki (2.1.15 and 2.1.19) on Ubuntu. As part of that process, ankisyncd is being requested to delete some media files which do not currently exist in the
collection.media
directory. This triggers the AssertionError onassert self.col.media.lastUsn() == oldUsn + processed_count
To help debug, I added some print statements to the immediately-preceding code:
The output is as follows:
The actual
collection.media
directory contains exactly the 1347 files which it would be expected to contain after a successful sync. Themedia_to_remove
(such as20180301160604_88997.mp3
) do exist under other users but not this user (yq-class-Z1
).Note that I've reproduced this every time that I try to sync, but the first time it failed there were not yet any debug print statements, so I don't have debug output from the first time it occurred.
Interestingly, I also see the same error when attempting to pull (force a download sync) from the server.
I am happy to help debug this if there's anything I can do to assist.
anki-sync-server
is a core piece of our infrastructure and I really appreciate your work on it.