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

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

Closed
maxjcohen opened this issue May 23, 2024 · 2 comments
Closed

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

maxjcohen opened this issue May 23, 2024 · 2 comments
Labels
🪲 bug Something isn't working

Comments

@maxjcohen
Copy link

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

🐞 Describe the bug
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.

💻 Components impacted
Android app.

💡 Screenshots and/or logs
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

🔮 Additional context

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 (but only on insecure http connection, since Traefik handles certificates).

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

Thanks.

@wunter8
Copy link
Contributor

wunter8 commented May 23, 2024

Have you tried changing the connection type in the Android app? Settings > Advanced > Connection protocol

Switch it to the other and see if that fixes things

@maxjcohen
Copy link
Author

Somehow this did not immediately solve the issue, but after rebooting my phone subscribing and notifications work as expected. I'll close this for now, thanks for the advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants