ankicommunity / anki-sync-server-rs

A personal custom Anki sync server,aim to provide an easier way for deployment
GNU Affero General Public License v3.0
180 stars 27 forks source link

Sync not reliable on desktop 2.1.60 #67

Open DrewRubin opened 1 year ago

DrewRubin commented 1 year ago

Hi,

I am on an M1 macbook running Anki desktop ⁨2.1.60. I find that most of the time the sync times out, with it very occasionally working. I am using "https://myurl.tld/" with the container behind a reverse proxy. No problems on AnkiDroid using the / and /msync URLs.

Logs from the server:

[2023-03-23T16:35:02+00:00 INFO  actix_web::middleware::logger] 10.42.0.243 "POST /sync/meta HTTP/1.1" 200 103 "-" "-" 0.006868
[2023-03-23T16:35:02+00:00 INFO  actix_web::middleware::logger] 10.42.0.243 "POST /sync/start HTTP/1.1" 200 43 "-" "-" 0.001131
[2023-03-23T16:36:03+00:00 INFO  anki::sync::http_server::user] aborting active sync

Logs from the client:

Error message:
Thu Mar 23 12:35:01 2023: Media sync starting...
Thu Mar 23 12:36:03 2023: Connection timed out. Please try again. If you see frequent timeouts, please try a different network connection.

Error details: ⁨⁩

Additional details: container running in K3s with Traefik.

Happy to get you guys more details if needed

dobefore commented 1 year ago

Hi!Thanks for providing detailed report containing server and cient.

Ignore this paragraph--TO be honest,the info on server side seems only part of hte log imessage,It is better to post the full message that the server generates when the desktop client Anki launches and begins to sync against the server until the client report the error message.

I assume your configuration should be correct,in your case the correct server address is https://myurl.tld:server port/,Because the Ankidroid sync normally.

After correct config,I think the problem may be caused by the following reason:

The size of collection of cards and media is so big that it takes much time to sync .It maybe exceed the default time limit,thus causing time out.This happened and is reportted in anki forum https://forums.ankiweb.net/t/local-sync-server-collection-exceeds-size-limit/27183/7.

The workaround is to increase limit of time out.

Go to Tools ->Preferences->syncing,increase the Network timeout up to ,say 60 seconds.And restart Anki and try syncing again.

If this is not a fix,please report

DrewRubin commented 1 year ago

Hey, thanks for the quick response. I actually have a very small library of anki cards currently (around 100). I've tried increasing the timeout to no avail. I'm also running this on a powerful server and not like a raspberry pi, so it shouldn't be a resource bottleneck. And just to reiterate, it does work on occasion, so it's the correct server address.

dobefore commented 1 year ago

Can you reproduce the result currently?In what condition it will fail or cause client Anki to sto[ syncing? Would you mind creating a new account and running tests with it until the error appears if it will not bother you too much? I just now have the server tested on windows,with client Anki 2.1.60 running on windows too and Ankidroid.No errors.

And I suggest that you can try this one https://docs.ankiweb.net/sync-server.html#without-gui-dependencies ,an official sync server ,installing via python pip.If it syncs sucessfully and not cause any error,then there is smoe problem in the server built from this repo. Amd Here is its dockerized version https://hub.docker.com/r/zweizs/anki-sync-server

codemonkeysoftware commented 1 year ago

I've been seeing this problem as well. I have no problem syncing on AnkiDroid in about 3 seconds, but with the new desktop app there is zero progress and then a timeout error. So I don't think it's anything to do with the size of the library. maybe some difference in how the clients handle the sync?

DrewRubin commented 1 year ago

Yeah I haven't had time to deploy the "official" sync client container. Also have not noticed any pattern in the failures or successes. To be clear, it fails almost all of the time, and on a rare occasion will sync, so it's hard to figure out the success conditions. Same situation as @codemonkeysoftware describes. Sometimes I get this error: HttpError { code: 408, context: "timeout monitor", source: None }

When I do deploy that other container I'll see if I face the same problems. @codemonkeysoftware, are you also running behind a reverse proxy or ingress?

prybalko commented 1 year ago

Have the same issue with ⁨2.1.61 on MacOS

codemonkeysoftware commented 1 year ago

@codemonkeysoftware, are you also running behind a reverse proxy or ingress?

I am running behind Traefik, and you bring up a good point. I'll have to try syncing directly to the server and see if it works better

codemonkeysoftware commented 1 year ago

OK, circumventing traffic and going straight to the container didn't help, but I did get it to run consistently by disabling media sync on the client and restarting the server.

Lil-Strudel commented 1 year ago

I have the same issue with 2.1.65 on Windows

orivee commented 1 year ago

Have the same issue with 2.1.65 on Arch Linux. Same situation as @codemonkeysoftware describes.

I try official sync server (https://hub.docker.com/r/zweizs/anki-sync-server) behind Traefik on wireguard. It's OK.

Cloufish commented 1 year ago

Same issue,

Also behind Traefik, I use Arch Linux btw.

allmwh commented 1 year ago

same issue on 2.1.61 on windows,

seems like traefik's problem, i change to syncing directly from port 27701, and it works