androidseb25 / iGotify-Notification-Assistent

Docker container for sending Gotify notifications to iOS devices (bridge to gotify websocket)
MIT License
99 stars 3 forks source link

[BUG] #50

Closed andre1808 closed 2 months ago

andre1808 commented 2 months ago

Describe the bug Regelmäßige disconnects und daher kein Push mehr auf iOS. Im Container log steht dann das folgende: 2024-04-12T15:49:21.437447000Z Done! 2024-04-12T15:49:21.445113000Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-13T06:53:26.310039000Z warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] 2024-04-13T06:53:26.310352000Z Failed to determine the https port for redirect. Lässt sich nur durch restart des Containers beheben.

Expected behavior Keine Disconnects :)

Smartphone (please complete the following information):

androidseb25 commented 2 months ago

Was steht den oberhalb des Logs kann er den prüfen ob er verbunden ist?

Normalerweise verbindet er sich automatisch sobald er nen disconnect bekommt...

Kann es auch sein das dein gotify Container ab und zu keine Verbindung zulässt?

andre1808 commented 2 months ago

Hier mal das ganze log. Eigentlich sollte er nichts blocken. Hab das docker compose file aus der Doku genommen.

2024-04-12T14:56:44.631569000Z Unhandled exception. System.Net.Http.HttpRequestException: Name or service not known (https://gotify.domain.com:443) 2024-04-12T14:56:44.631698000Z ---> System.Net.Sockets.SocketException (0xFFFDFFFF): Name or service not known 2024-04-12T14:56:44.631747000Z at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) 2024-04-12T14:56:44.631785000Z at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 2024-04-12T14:56:44.631821000Z at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) 2024-04-12T14:56:44.631859000Z at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:44.631892000Z --- End of inner exception stack trace --- 2024-04-12T14:56:44.631922000Z at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:44.631953000Z at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:44.631984000Z at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:44.632016000Z at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem) 2024-04-12T14:56:44.632048000Z at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) 2024-04-12T14:56:44.632078000Z at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) 2024-04-12T14:56:44.632109000Z at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:44.632137000Z at System.Net.Http.HttpClient.gCore|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 2024-04-12T14:56:44.632164000Z at SecNtfyNuGet.SecNtfy.CheckIfUrlReachable(String url) 2024-04-12T14:56:44.632193000Z at iGotify_Notification_Assist.Services.GotifySocketService.Start() in /src/Services/GotifySocketService.cs:line 101 2024-04-12T14:56:44.632221000Z at System.Threading.Tasks.Task.<>c.b__128_1(Object state) 2024-04-12T14:56:44.632248000Z at System.Threading.ThreadPoolWorkQueue.Dispatch() 2024-04-12T14:56:44.632277000Z at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() 2024-04-12T14:56:45.547910000Z Database is created: True 2024-04-12T14:56:53.727400000Z Unhandled exception. System.Net.Http.HttpRequestException: Name or service not known (gotify.domain.com:443) 2024-04-12T14:56:53.727546000Z ---> System.Net.Sockets.SocketException (0xFFFDFFFF): Name or service not known 2024-04-12T14:56:53.727595000Z at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) 2024-04-12T14:56:53.727631000Z at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) 2024-04-12T14:56:53.727666000Z at System.Net.Sockets.Socket.gWaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken) 2024-04-12T14:56:53.727701000Z at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:53.727733000Z --- End of inner exception stack trace --- 2024-04-12T14:56:53.727763000Z at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:53.727794000Z at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:53.727825000Z at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:53.727858000Z at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem) 2024-04-12T14:56:53.727888000Z at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) 2024-04-12T14:56:53.727916000Z at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) 2024-04-12T14:56:53.727946000Z at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) 2024-04-12T14:56:53.727974000Z at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) 2024-04-12T14:56:53.728002000Z at SecNtfyNuGet.SecNtfy.CheckIfUrlReachable(String url) 2024-04-12T14:56:53.728033000Z at iGotify_Notification_Assist.Services.GotifySocketService.Start() in /src/Services/GotifySocketService.cs:line 101 2024-04-12T14:56:53.728064000Z at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state) 2024-04-12T14:56:53.728100000Z at System.Threading.ThreadPoolWorkQueue.Dispatch() 2024-04-12T14:56:53.728133000Z at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() 2024-04-12T14:56:54.597493000Z Database is created: True 2024-04-12T14:56:55.236801000Z Gotify - Url: https://gotify.domain.com 2024-04-12T14:56:55.236929000Z Is Gotify - Url available: yes 2024-04-12T14:56:55.236973000Z SecNtfy Server - Url: https://api.secntfy.app 2024-04-12T14:56:55.237007000Z Is SecNtfy Server - Url available: yes 2024-04-12T14:56:55.237120000Z Client - Token: XXXX 2024-04-12T14:56:55.241354000Z Client connecting... 2024-04-12T14:56:55.281891000Z Done! 2024-04-12T14:56:55.294038000Z info: Microsoft.Hosting.Lifetime[14] 2024-04-12T14:56:55.294170000Z Now listening on: http://[::]:8080 2024-04-12T14:56:55.295947000Z info: Microsoft.Hosting.Lifetime[0] 2024-04-12T14:56:55.296027000Z Application started. Press Ctrl+C to shut down. 2024-04-12T14:56:55.296571000Z info: Microsoft.Hosting.Lifetime[0] 2024-04-12T14:56:55.296641000Z Hosting environment: Production 2024-04-12T14:56:55.296785000Z info: Microsoft.Hosting.Lifetime[0] 2024-04-12T14:56:55.296840000Z Content root path: /app 2024-04-12T15:13:49.923123000Z 2024-04-12T15:13:49.923253000Z WS Instance from: XXXXX 2024-04-12T15:13:50.197193000Z 2024-04-12T15:17:23.269112000Z 2024-04-12T15:17:23.269185000Z WS Instance from: XXX 2024-04-12T15:17:23.395397000Z 2024-04-12T15:48:32.953619000Z 2024-04-12T15:48:32.953768000Z WS Instance from: XXX 2024-04-12T15:48:33.382123000Z 2024-04-12T15:49:21.432587000Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-12T15:49:21.433031000Z Connection lost reconnect to Websocket... 2024-04-12T15:49:21.436012000Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-12T15:49:21.437447000Z Done! 2024-04-12T15:49:21.445113000Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-13T06:53:26.310039000Z warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] 2024-04-13T06:53:26.310352000Z Failed to determine the https port for redirect. 2024-04-13T07:01:10.849199000Z info: Microsoft.Hosting.Lifetime[0] 2024-04-13T07:01:10.849976000Z Application is shutting down... 2024-04-13T07:01:19.743943000Z Database is created: True 2024-04-13T07:01:20.253000000Z Gotify - Url: https://gotify.domain.com 2024-04-13T07:01:20.253371000Z Is Gotify - Url available: yes 2024-04-13T07:01:20.253531000Z SecNtfy Server - Url: https://api.secntfy.app 2024-04-13T07:01:20.253652000Z Is SecNtfy Server - Url available: yes 2024-04-13T07:01:20.254088000Z Client - Token: XXXX 2024-04-13T07:01:20.258488000Z Client connecting... 2024-04-13T07:01:20.292499000Z Done! 2024-04-13T07:01:20.308369000Z info: Microsoft.Hosting.Lifetime[14] 2024-04-13T07:01:20.308500000Z Now listening on: http://[::]:8080 2024-04-13T07:01:20.310539000Z info: Microsoft.Hosting.Lifetime[0] 2024-04-13T07:01:20.310624000Z Application started. Press Ctrl+C to shut down. 2024-04-13T07:01:20.311279000Z info: Microsoft.Hosting.Lifetime[0] 2024-04-13T07:01:20.311343000Z Hosting environment: Production 2024-04-13T07:01:20.311377000Z info: Microsoft.Hosting.Lifetime[0] 2024-04-13T07:01:20.311415000Z Content root path: /app 2024-04-13T07:01:32.337135000Z warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] 2024-04-13T07:01:32.337385000Z Failed to determine the https port for redirect.

androidseb25 commented 2 months ago

erste Zeile des logs

2024-04-12T14:56:44.631569000Z Unhandled exception. System.Net.Http.HttpRequestException: Name or service not known (https://gotify.domain.com)

der kommt an deinen Gotify nicht ran!

Entweder verhindert, wenn vorhanden deine FW das oder was anderes im Netzwerk löst die Verbindung nicht auf

andre1808 commented 2 months ago

Hm. Dann sollte er aber generell Probleme haben oder? Nach einem Neustart des Containers läuft es eigentlich immer wieder. Firewall seitig blocke ich auch nichts. Glaube der Fehler ist eher weil zu dem Zeitpunkt gotify noch nicht lief - kann das sein?

ps: kannst du meine Domain rauseditieren? Hab auf dem Handy das Logo nicht komplett durchgelesen und gefiltert 😅

androidseb25 commented 2 months ago

ja es kann gut möglich sein das der gotify server später da ist als mein service...

aber teilweise die reconnect versuche hatten ja auch nicht geklappt, so wie ich im log sehe

Deine Domain und andere Daten hab ich rausgelöscht

andre1808 commented 2 months ago

Ich gucke gleich nochmal nach dem einkaufen ob ich vielleicht was im nginx sehen kann oder so. Danke dir schonmal!

andre1808 commented 2 months ago

Hallo Seb. Ich hab nochmal geguckt (sorry, hat etwas länger gedauert - hab das Wetter ausgenutzt und war Tennis spielen :)) Also was ich sehen kann, war gotify.domain.com durchgängig online, mit der Ausnahme, wenn ich Backups mache, oder anderweitig händisch was war (z.B. hab ich gestern versehentlich den Strom gezogen :D)

Ich mache in der Nacht von Sonntag zu Montag um 1 Uhr ein Backup meine Proxmox LXCs und VMs. Aber ansonsten ist alles durchgängig up. Bin etwas ratlos :(

androidseb25 commented 2 months ago

mmmmh da fällt mir auch nichts mehr ein, es muss definitiv was bei dir sein, da bei meinen Teststellungen und in meiner Produktiv, sowie Arbeitsumgebung läuft das alles tadellos :/

ich lass den Issue mal offen vielleicht gibt es noch weitere mit dem selben Problem

andre1808 commented 2 months ago

Heute Nacht liefen die Backups und zumindest aktuell scheint noch alles zu laufen. Ich beobachte es mal weiter :)

dia5ha commented 2 months ago

Sorry, habe das gleiche Problem. Verliere täglich die Verbindung und nach Neustart des Containers funktioniert es wieder. So wie ich es aus meinen Logs entnehmen zu meine, passiert es immer nach Zwangstrennung durch Provider. Aber vielleicht mache ich auch etwas falsch.

androidseb25 commented 2 months ago

Sorry, habe das gleiche Problem. Verliere täglich die Verbindung und nach Neustart des Containers funktioniert es wieder. So wie ich es aus meinen Logs entnehmen zu meine, passiert es immer nach Zwangstrennung durch Provider. Aber vielleicht mache ich auch etwas falsch.

Was stgeht den bei dir im Log hinter folgenden eintrag

Disconnection happened, type: XXXX

dia5ha commented 2 months ago

Schaut dann so aus: 2024-04-15T16:28:05.473851745Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-15T16:28:05.473882755Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-15T16:28:05.473888970Z Connection lost reconnect to Websocket... 2024-04-15T16:28:05.473894208Z Connection lost reconnect to Websocket... 2024-04-15T16:28:05.475272374Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-15T16:28:05.475298704Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-15T16:28:05.476670513Z Done! 2024-04-15T16:28:05.476700056Z Done! 2024-04-15T16:28:05.477993016Z Disconnection happened, type: Websocket.Client.DisconnectionInfo 2024-04-15T16:28:05.478433780Z Disconnection happened, type: Websocket.Client.DisconnectionInfo

androidseb25 commented 2 months ago

Ok das selbe was oben ist, komisch ist das es eine DisconnectionInfo ist normalerweise wenn es einen Disconnect gibt steht dort DisconnectionLost

Das sieht nach einer Lokalen Netzwerk Problem aus sonst würde er die dauerhaft halten.

Ich kann um das Problem zu fixen einen optionalen flag hinzufügen der ein reconnect durchführt bei der DisconnectionInfo, was aber dahinführen kann das er in ein Loop gerät und mehrere Connection eröffnet und man mehrfach Nachrichten bekommt...

Bitte schaut nochmal ob es nicht doch bei euch nen Problem im Netzwerk gibt.

Ansonsten sagt nochmal Bescheid dann würde ich die Option einbauen

dia5ha commented 2 months ago

Super und vielen Dank. Ich schau noch einmal würde mich ggf. noch einmal melden

andre1808 commented 2 months ago

Also ich wüsste wirklich nicht was bei mir lokalen Netzwerk dazwischen funken könnte ehrlich gesagt :( Ich hab alles unter proxmox laufen. IGotify und Gotify laufen in einem lxc Container mit Docker installiert und watchtower für Updates. Sonst läuft darauf nichts.

Ein weiter lxc Container beherbergt Nginx Proxy Manager als Reverse Proxy. Ich habe derzeit keine unterschiedliche VLANs und alles läuft in einer IP Range. Andere Container haben bisweilen keine Probleme gezeigt. Auch Gotify selbst ist erreichbar, auch wenn die Pushnachrichten nicht mehr zugestellt werden. Öffne ich deine App erscheinen auch die Nachrichten - es ist also echt nur das Push was ein Problem macht :(

von daher fände ich eine reconnect Option cool. wenn nicht muss ich halt hin und wieder den Container durchstarten 😅

androidseb25 commented 2 months ago

Bitte versucht mal die neue Version, hab den Workflow des WebSockets nochmal überarbeitet, vielleicht hilft das schon.

https://github.com/androidseb25/iGotify-Notification-Assistent/releases/tag/v1.2.0.3

Falls der Fehler wieder auftritt bitte Issue nochmal öffnen

andre1808 commented 2 months ago

Vielen Dank. Ich werde es mal probieren und berichten :) Danke für deinen tollen Support!

dia5ha commented 2 months ago

Bin begeistert, mit neuer Version rennt es jetzt bei mir mit Push Notifications auf phone und watch. Log sieht nach Restart Container auch super aus: 2024-04-16T14:46:33.603857225Z Client connecting... 2024-04-16T14:46:33.638466734Z Done! 2024-04-16T14:49:40.255990058Z Disconnection happened, type: Lost 2024-04-16T14:49:40.256030076Z Connection lost reconnect to Websocket... 2024-04-16T14:49:40.257242649Z Disconnection happened, type: ByUser 2024-04-16T14:49:40.271322513Z Disconnection happened, type: Error 2024-04-16T14:49:40.271347306Z Webseocket Reconnection failed with Error. Try to reconnect in 10s. 2024-04-16T14:49:50.283344868Z Gotify with Clienttoken: "xxxxxxxxxxx" is successfully reconnected! Vielen Dank für das tolle Projekt und den tollen Support!

androidseb25 commented 2 months ago

super das freut mich das es jetzt klappt :D

Kein Problem der Support gehört dazu ^^

andre1808 commented 2 months ago

Wollte nochmal kurz Feedback hinterlassen: Nachdem ich gerade meine HDD im Raid austauschen musste und vergessen hatte meinen DNS wieder hochzufahren, hatte iGotify natürlich Probleme mit der Verbindung. Der Reconnect funktionierte aber perfekt! Sobald mein DNS wieder erreichbar war, war iGotify wieder bereit :)

2024-04-16T19:17:07.972875000Z Gotify Server is not available try to reconnect in 10s. 2024-04-16T19:17:17.975008000Z Reconnecting... 2024-04-16T19:17:33.990184000Z Gotify Server is not available try to reconnect in 10s. 2024-04-16T19:17:43.991028000Z Reconnecting... 2024-04-16T19:18:00.006881000Z Gotify Server is not available try to reconnect in 10s. 2024-04-16T19:18:10.008415000Z Reconnecting... 2024-04-16T19:18:26.024232000Z Gotify Server is not available try to reconnect in 10s. 2024-04-16T19:18:36.021551000Z Reconnecting... 2024-04-16T19:18:36.755729000Z Gotify - Url: https://gotify.domain.com 2024-04-16T19:18:36.756220000Z Is Gotify - Url available: yes 2024-04-16T19:18:36.756472000Z SecNtfy Server - Url: https://api.secntfy.app 2024-04-16T19:18:36.756633000Z Is SecNtfy Server - Url available: yes 2024-04-16T19:18:36.756737000Z Client - Token: xxx 2024-04-16T19:18:36.761676000Z Client connecting... 2024-04-16T19:18:36.809536000Z Done!

Also nochmals großes Lob ;)

androidseb25 commented 2 months ago

perfekt das freut mich das es funktioniert ^^