binwiederhier / ntfy-android

Android app for ntfy.sh
Apache License 2.0
465 stars 92 forks source link

Timeout on topic subscription (self hosted behind Traefik) #79

Closed maxjcohen closed 1 month ago

maxjcohen commented 1 month ago

Hi, and thanks for developing Ntfy, it's just great.

I've recently moved my Ntfy instance behind Traefik for automating TLS stuff, adjusted the configuration for Ntfy, and notifications seem to work just as before on the web app. However, when subscribing to the server on the Android app, I get a timeout.

What works

  1. From my phone, open the web app on my domain name, which though Traefik redirects to the Ntfy server. Things work.
  2. From my phone, and from the Android app, connect directly to the Ntfy server (bypassing Traefik, using a different port opened by Docker). Things work.

What does not work

From my phone, and from the Android app, connect to the Ntfy server through Traefik. I get a timeout error.

My configuration

      - NTFY_AUTH_FILE=/var/lib/auth/auth.db
      - NTFY_AUTH_DEFAULT_ACCESS=read-only
      - NTFY_CACHE_FILE=/var/cache/ntfy/cache.db
      - NTFY_BASE_URL=https://{{ domain }}
      - NTFY_BEHIND_PROXY=true
      - NTFY_UPSTREAM_BASE_URL=https://ntfy.sh

The Android app's logs

This is a log of the ntfy Android app. The log shows up to 1,000 entries.

Device info:
--
ntfy: 1.16.0 (fdroid)
OS: 4.9.292-ga72d58f85040
Android: 12 (SDK 32)
Model: sargo
Product: sargo

--
Settings:                    
{
  "autoDeleteSeconds": 2592000,
  "autoDownloadMaxSize": 1048576,
  "broadcastEnabled": true,
  "connectionProtocol": "jsonhttp",
  "darkMode": -1,
  "defaultBaseUrl": "",
  "lastSharedTopics": [],
  "minPriority": 1,
  "mutedUntil": 0,
  "recordLogs": true
}

Logs
--

1716303690986 2024-05-21 17:01:30.986 D NtfyLog Enabled log recording
1716303696744 2024-05-21 17:01:36.744 D NtfyMainActivity Create io.heckel.ntfy.ui.MainActivity@102528
1716303696747 2024-05-21 17:01:36.747 D NtfyMainActivity Poll worker version matches: choosing KEEP as existing work policy
1716303696747 2024-05-21 17:01:36.747 D NtfyMainActivity Poll worker: Scheduling period work every 60 minutes
1716303696747 2024-05-21 17:01:36.747 D NtfyMainActivity ServiceStartWorker version matches: choosing KEEP as existing work policy
1716303696747 2024-05-21 17:01:36.747 D NtfyMainActivity ServiceStartWorker: Scheduling period work every 180 minutes
1716303696748 2024-05-21 17:01:36.748 D NtfyMainActivity Delete worker version matches: choosing KEEP as existing work policy
1716303696748 2024-05-21 17:01:36.748 D NtfyMainActivity Delete worker: Scheduling period work every 480 minutes
1716303696751 2024-05-21 17:01:36.751 D NtfyMainActivity Battery: ignoring optimizations = true (we want this to be true); instant subscriptions = false; remind time reached = true; banner = false
1716303696780 2024-05-21 17:01:36.780 D NtfySubscriberMgr Enqueuing work to refresh subscriber service
1716303696782 2024-05-21 17:01:36.782 D NtfyMainActivity Battery: ignoring optimizations = true (we want this to be true); instant subscriptions = false; remind time reached = true; banner = false
1716303696787 2024-05-21 17:01:36.787 D NtfyMainActivity Checking global and subscription-specific 'muted until' timestamp
1716303707155 2024-05-21 17:01:47.155 D NtfyApiService Checking anonymous read against https://<MYSERVER>/<TOPIC>
1716303722159 2024-05-21 17:02:02.159 W NtfyAddFragment Connection to topic failed: timeout
Exception:
java.io.InterruptedIOException: timeout
    at okhttp3.internal.connection.RealCall.timeoutExit(RealCall.kt:398)
    at okhttp3.internal.connection.RealCall.callDone(RealCall.kt:360)
    at okhttp3.internal.connection.RealCall.noMoreExchanges$okhttp(RealCall.kt:325)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:209)
    at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
    at io.heckel.ntfy.msg.ApiService.checkAuth(ApiService.kt:156)
    at io.heckel.ntfy.ui.AddFragment$checkReadAndMaybeShowLogin$1.invokeSuspend(AddFragment.kt:209)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: java.io.IOException: Canceled
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:72)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
    ... 11 more

1716303726092 2024-05-21 17:02:06.092 D NtfyMainActivity Checking global and subscription-specific 'muted until' timestamp
1716303727717 2024-05-21 17:02:07.717 D NtfySettingsActivity Create io.heckel.ntfy.ui.SettingsActivity@a09e9e4

thanks.

maxjcohen commented 1 month ago

Reopened in https://github.com/binwiederhier/ntfy/issues/1116