Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync fails after changing cards in any way (applyChanges) #131

Closed
croxxx opened this issue May 7, 2022 · 4 comments
Closed

Sync fails after changing cards in any way (applyChanges) #131

croxxx opened this issue May 7, 2022 · 4 comments

Comments

@croxxx
Copy link

croxxx commented May 7, 2022

Summary

Whenever I try to do a regular sync (not a full sync) after any changes I am presented with an error in both AnkiDroid and Anki Desktop ("Please try again later").
Similar to #130 sync does not work on Anki Desktop when changes are present on either side.

Interestingly, this one also has a secondary error in another HTTP request: POST /sync/applyChanges

AnkiDesktop ⁨2.1.50 (26d40c3a)⁩ Flatpak

Logs given by my system when the error occurs:

[2022-05-07 14:21:50,979]:INFO:ankisyncd.CollectionThread[croxxx]:Running meta(*[], **{'v': 10, 'cv': 'anki,2.1.50 (26d40c3a),lin:org.freedesktop.platform:21.08.13'})
[2022-05-07 14:21:50,993]:INFO:ankisyncd.http:172.17.0.1 "POST /sync/meta HTTP/1.0" 200 147
[2022-05-07 14:21:51,471]:INFO:ankisyncd.CollectionThread[croxxx]:Running begin(*[], **{'skey': '3f1f3c4a'})
[2022-05-07 14:21:51,472]:INFO:ankisyncd.http:172.17.0.1 "GET /msync/begin?k=e867339bc323d7eebc71b6bb40eb0610&v=anki%2C2.1.50+%2826d40c3a%29%2Clin%3Aorg.freedesktop.platform%3A21.08.13 HTTP/1.0" 200 52
[2022-05-07 14:21:51,479]:INFO:ankisyncd.CollectionThread[croxxx]:Running meta(*[], **{'v': 10, 'cv': 'anki,2.1.50 (26d40c3a),lin:org.freedesktop.platform:21.08.13'})
[2022-05-07 14:21:51,481]:INFO:ankisyncd.http:172.17.0.1 "POST /sync/meta HTTP/1.0" 200 147
[2022-05-07 14:21:51,510]:INFO:ankisyncd.CollectionThread[croxxx]:Running start(*[], **{'minUsn': 2493, 'lnewer': False, 'graves': None})
[2022-05-07 14:21:51,512]:INFO:ankisyncd.http:172.17.0.1 "POST /sync/start HTTP/1.0" 200 39
[2022-05-07 14:21:51,535]:INFO:ankisyncd.CollectionThread[croxxx]:Running applyChanges(*[], **{'changes': {'models': [], 'decks': [[], []], 'tags': []}})
[2022-05-07 14:21:51,567]:ERROR:ankisyncd.CollectionThread[croxxx]:Unable to applyChanges(*[], **{'changes': {'models': [], 'decks': [[], []], 'tags': []}}): 'Collection' object has no attribute 'all_config'
Traceback (most recent call last):
  File "/opt/ankisyncd/ankisyncd/thread.py", line 98, in _run
    ret = self.wrapper.execute(func, args, kw, return_queue)
  File "/opt/ankisyncd/ankisyncd/collection.py", line 45, in execute
    ret = func(*args, **kw)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 712, in run_func
    res = handler_method(**keyword_args)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 133, in applyChanges
    lchg = self.changes()
  File "/opt/ankisyncd/ankisyncd/sync.py", line 76, in changes
    d['conf'] = self.col.all_config()
AttributeError: 'Collection' object has no attribute 'all_config'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 517, in __call__
    w= self.__wrapped__(*args, **kwargs)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 656, in __call__
    result = self._execute_handler_method_in_thread(url, data, session)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 721, in _execute_handler_method_in_thread
    result = thread.execute(run_func, kw=keyword_args)
  File "/opt/ankisyncd/ankisyncd/thread.py", line 79, in execute
    raise ret
  File "/opt/ankisyncd/ankisyncd/thread.py", line 98, in _run
    ret = self.wrapper.execute(func, args, kw, return_queue)
  File "/opt/ankisyncd/ankisyncd/collection.py", line 45, in execute
    ret = func(*args, **kw)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 712, in run_func
    res = handler_method(**keyword_args)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 133, in applyChanges
    lchg = self.changes()
  File "/opt/ankisyncd/ankisyncd/sync.py", line 76, in changes
    d['conf'] = self.col.all_config()
AttributeError: 'Collection' object has no attribute 'all_config'
[2022-05-07 14:21:51,569]:INFO:ankisyncd.http:172.17.0.1 "POST /sync/applyChanges HTTP/1.0" 500 59
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/wsgiref/handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 517, in __call__
    w= self.__wrapped__(*args, **kwargs)
  File "/opt/ankisyncd/ankisyncd/sync_app.py", line 630, in __call__
    raise HTTPNotFound()
webob.exc.HTTPNotFound: The resource could not be found.
[2022-05-07 14:21:51,592]:INFO:ankisyncd.http:172.17.0.1 "POST /sync/abort HTTP/1.0" 500 59

Relevant parts of code I identified:

GitHub itself shows no relation to any existing method all_config in its preview, so I assume this to be incorrectly referenced.

@croxxx
Copy link
Author

croxxx commented May 7, 2022

After some more digging, it seems this has already cropped up as part of #110 and was commented on as resolved by the author #110 (comment)
As #110 was merged in March and I used the latest Docker image ankicommunity/anki-sync-server:20220420, which was built a month after, I assume this should not be happening?
In case this is simply caused by outdated build dependencies for the Docker image, feel free to close this here and I will file the issue in the respective repository.

@ghoski
Copy link

ghoski commented May 11, 2022

A dependency upgrade (anki==2.1.49) does indeed fix the issue, but I'm not experienced enough with this software to know if it causes any other problems.

@VikashKothary
Copy link
Member

I've updated the dependencies and triggered a new build for the docker image. Please let me know if this resolves your issue.

Thank you for bringing this to my attention :)

@croxxx
Copy link
Author

croxxx commented May 17, 2022

Works like a charm now. Thanks for the prompt fix.
Closing this and #130.

@croxxx croxxx closed this as completed May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants