How to fix sync with custom sync server (“error sending request”) after router reset?

Antecedent

I had sync working and running locally over wifi. For that, a script on my linux PC was starting the custom sync server. It contains just this:

SYNC_HOST=[IP] SYNC_PORT=[PORT] SYNC_BASE=[PATH_TO_SYNC_SERVER_STORAGE] SYNC_USER1=[USERNAME]:[PASSWORD] anki --syncserver

The things in [ ] have actual values, of course.

It worked for months but then I had to reset my router the other day as part of trouble shooting (turns out it was a local outage that wasn’t reported). Originally, I had this: SYNC_HOST=192.168.8.175. But this didn’t work anymore after my router reset. So, now, it is like this: SYNC_HOST=192.168.8.100.

Issue

With SYNC_HOST=192.168.8.100, I can sync my computer just fine. I, of course, had to change the IP in ankis settings, but then it worked. I have no idea why that change was necessary in the first place, but making the exact change in Ankidroid, I get an error: “error sending request”.

That is odd and didn’t help much, so I connected my smartphone to my PC an ran

logcat --pid=`pidof -s com.ichi2.anki`

This is from inside the shell after doing adb shell.

The logcat log
--------- beginning of system
06-30 18:56:14.779 11057 11057 V ResourcesManager: The following library key has been added: ResourcesKey{ mHash=f645b1f5 mResDir=null mSplitDirs=[] mOverlayDirs=[] mLibDirs=[/product/app/webview/webview.apk,/system/framework/android.test.base.jar,/system_ext/framework/androidx.window.extensions.jar] mDisplayId=0 mOverrideConfig=v36 mCompatInfo={420dpi always-compat} mLoaders=[]}
06-30 18:56:14.796 11057 11057 I DisplayManager: Implicitly registering for refresh rate
06-30 18:56:14.986 11057 11057 D InsetsController: hide(ime())
06-30 18:56:17.599 11057 11057 D InsetsController: hide(ime())
06-30 18:56:19.882 11057 11057 D InsetsController: hide(ime())
06-30 18:56:26.073 11057 11057 D InsetsController: hide(ime())
06-30 18:56:26.701 11057 11057 D InsetsController: show(ime())
06-30 18:56:26.701 11057 11057 D InsetsController: Setting requestedVisibleTypes to 511 (was 503)
06-30 18:56:36.565 11057 11057 D InsetsController: hide(ime())
06-30 18:56:36.566 11057 11057 D InsetsController: Setting requestedVisibleTypes to 503 (was 511)
06-30 18:56:36.570 11057 11057 D InsetsController: hide(ime())
06-30 18:56:38.258 11057 11057 D InsetsController: hide(ime())
--------- beginning of main
06-30 18:59:41.409 11057 11057 I ImeTracker: com.ichi2.anki:14753c3d: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
06-30 18:59:41.410 11057 11057 D InsetsController: hide(ime())
06-30 18:59:41.410 11057 11057 I ImeTracker: com.ichi2.anki:14753c3d: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
06-30 18:59:41.412 11057 11057 I AnkiDroid: Logging in
06-30 18:59:41.685 11057 11057 W AnkiDroid: q/ Login error
06-30 19:02:14.465 11057 11057 I AnkiDroid: SingleFragmentActivity::onPause
06-30 19:02:14.465 11057 11057 I AnkiDroid: SingleFragmentActivity::LoginFragment::onPause
06-30 19:02:14.849 11057 11057 D VRI[SingleFragmentActivity]: visibilityChanged oldVisibility=true newVisibility=false
06-30 19:02:14.885 11057 11057 I AnkiDroid: SingleFragmentActivity::onStop
06-30 19:02:14.886 11057 11057 I AnkiDroid: SingleFragmentActivity::LoginFragment::onStop
06-30 19:02:14.888 11057 11057 I AnkiDroid: SingleFragmentActivity::onSaveInstanceState
06-30 19:02:14.888 11057 11057 I AnkiDroid: SingleFragmentActivity::LoginFragment::onSaveInstanceState
06-30 19:06:19.493 11057 11057 I AnkiDroid: SingleFragmentActivity::onStart
06-30 19:06:19.496 11057 11057 I AnkiDroid: SingleFragmentActivity::LoginFragment::onStart
06-30 19:06:19.502 11057 11057 I AnkiDroid: SingleFragmentActivity::onResume
06-30 19:06:19.504 11057 11057 I AnkiDroid: SingleFragmentActivity::LoginFragment::onResume
06-30 19:06:19.570 11057 11057 D InsetsController: show(ime())
06-30 19:06:19.570 11057 11057 D InsetsController: Setting requestedVisibleTypes to 511 (was 503)
06-30 19:06:19.616 11057 11057 D WindowOnBackDispatcher: setTopOnBackInvokedCallback (unwrapped): android.view.ImeBackAnimationController@946a3f6
06-30 19:06:19.661 11057 11057 D VRI[SingleFragmentActivity]: WindowInsets changed: ime:[0,0,0,1062] 
06-30 19:06:19.862 11057 11057 I ImeTracker: com.ichi2.anki:68f41ba5: onShown
06-30 19:06:43.745 11057 11057 I ImeTracker: com.ichi2.anki:2abbce48: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
06-30 19:06:43.745 11057 11057 D InsetsController: hide(ime())
06-30 19:06:43.746 11057 11057 D WindowOnBackDispatcher: setTopOnBackInvokedCallback (unwrapped): android.app.Activity$$ExternalSyntheticLambda0@e00e65f
06-30 19:06:43.746 11057 11057 D InsetsController: Setting requestedVisibleTypes to 503 (was 511)
06-30 19:06:43.754 11057 11057 I AnkiDroid: Logging in
06-30 19:06:43.759 11057 11057 I ImeTracker: com.ichi2.anki:86f016a1: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT_FROM_VIEW fromUser false
06-30 19:06:43.760 11057 11057 D InsetsController: hide(ime())
06-30 19:06:43.760 11057 11057 I ImeTracker: com.ichi2.anki:86f016a1: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
06-30 19:06:43.760 11057 11057 D VRI[SingleFragmentActivity]: WindowInsets changed: ime:null 
06-30 19:06:43.784 11057 11057 I ImeTracker: system_server:5174d03a: onCancelled at PHASE_CLIENT_ON_CONTROLS_CHANGED
06-30 19:06:43.792 11057 11057 W AnkiDroid: q/ Login error

I do not know what the issue is or how to solve it from here on. Nothing changed (like sync server setup or app versions). Only the router reset.

I thought that maybe some settings of my router have been reset that are causing ankidroid to fail to sync. But I couldn’t find a setting that would do that in my router configuration (and don’t know what to look out for anyways).

Deleting cache and turning off the firewall on my PC that hosts the sync server didn’t help either. How can I solve this?

Edit: I’d like to add that I can ping my computer from my smartphone via ping 192.168.8.100:

PING 192.168.8.100 (192.168.8.100) 56(84) bytes of data.
64 bytes from 192.168.8.100: icmp_seq=1 ttl=64 time=257 ms
64 bytes from 192.168.8.100: icmp_seq=2 ttl=64 time=74.3 ms
64 bytes from 192.168.8.100: icmp_seq=3 ttl=64 time=95.5 ms
64 bytes from 192.168.8.100: icmp_seq=4 ttl=64 time=216 ms
64 bytes from 192.168.8.100: icmp_seq=5 ttl=64 time=241 ms
64 bytes from 192.168.8.100: icmp_seq=6 ttl=64 time=9.33 ms

--- 192.168.8.100 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5012ms
rtt min/avg/max/mdev = 9.336/149.001/257.160/93.719 ms

And on linux nmap -sn 192.168.8.0/24 shows the following devices:

  • router: 192.168.8.1
  • Linux PC: 192.168.8.100
  • Smartphone: 192.168.8.180

Debug Info

AnkiDroid Version = 2.24.0 (ebcf8e0e34921628b9b8a496c66ffd4adbb3705f)  
Backend Version = 0.1.64-anki25.09.2 (25.09.2 3890e12c9e48c028c3f12aa58cb64bd9f8895e30)  
Android Version = 16 (SDK 36)  
ProductFlavor = full  
Device Info = Google | google | tokay | tokay | Pixel 9 | tokay  
WebView Info = [com.android.webview | 777812001]: Mozilla/5.0 (Linux; Android 16; Pixel 9 Build/BP4A.251205.006; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/148.0.7778.120 Mobile Safari/537.36  
ACRA UUID = a01f899c-0f3c-4342-a8f9-61f74e3db082  
FSRS = 5.1.0 (Enabled: true)  
Crash Reports Enabled = true

I figured it out.

I had a second firewall which I had not disabled because I forgot about it. Resetting my wifi router and reconnecting to it triggered that firewall, which now blocked other PCs / Smartphones from accessing my host PC.

Changing the settings of that firewall solved the issue.

(but still odd that the ping from my phone worked, no?)