louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
58.71k stars 5.29k forks source link

Webpage Reloads Repeatedly - [Cannot connect to Socket Server] #3884

Closed zluckytraveler closed 9 months ago

zluckytraveler commented 1 year ago

⚠️ Please verify that this bug has NOT been raised before.

🛡️ Security Policy

Description

Anywhere from a just a couple times an hour to just a few minutes apart my Uptime Kuma dashboard will display this red message notification at the top of the screen about being unable to connect to the socket server (See Screenshot), for only a 1-2 second glimpse, then immediately refresh the webpage and return to back to normal. Then the process repeats itself again, over and over endlessly.

I cannot see any exact length of time between it occurring where it is a pattern.

Cannot connect to the socket server. [Error: timeout] Reconnecting...

There is no problem with my dashboard functionality, accessing the dashboard, my monitors, or anything else, just that it does this all the time, and would happily like it to stop, and remain static, as expected.

Within the docker container output I can see that Uptime Kuma is constantly logging into the account, as least that's how it appears to me, and not sure if this is the issue or not, but though it may be relevant to include.

I've included only a 3 hour period of output, as this is repeated an immense amount of times.

FYI: This issue has been persistent for easily over 6+ Months, and finally tired of it, and figured it's time to handle it.

screenshot

👟 Reproduction steps

I am not triggering it, or at the very least do not know how or why it's being triggered. It just happens on its own anywhere from a just a couple times an hour to just a few minutes apart.

👀 Expected behavior

For my webpage to remain static and work as expected.

😓 Actual Behavior

The webpage is constantly reloading.

🐻 Uptime-Kuma Version

Version: 1.23.3

💻 Operating System and Arch

macOS Sonoma Version 14.0

🌐 Browser

Safari Version 17.0

🐋 Docker Version

Docker Version 4.21.1

🟩 NodeJS Version

No response

📝 Relevant log output

2023-10-12 16:37:21 2023-10-12T16:37:21-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 17:16:46 2023-10-12T17:16:46-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 17:16:46 2023-10-12T17:16:46-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 17:16:46 2023-10-12T17:16:46-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 17:16:48 2023-10-12T17:16:48-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 17:16:48 2023-10-12T17:16:48-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 17:16:48 2023-10-12T17:16:48-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 17:36:19 2023-10-12T17:36:19-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 17:36:19 2023-10-12T17:36:19-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 17:36:19 2023-10-12T17:36:19-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 17:36:21 2023-10-12T17:36:21-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 17:36:21 2023-10-12T17:36:21-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 17:36:21 2023-10-12T17:36:21-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 18:37:08 2023-10-12T18:37:08-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 18:37:08 2023-10-12T18:37:08-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 18:37:08 2023-10-12T18:37:08-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 18:37:10 2023-10-12T18:37:10-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 18:37:10 2023-10-12T18:37:10-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 18:37:10 2023-10-12T18:37:10-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 18:49:50 2023-10-12T18:49:50-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 18:49:50 2023-10-12T18:49:50-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 18:49:50 2023-10-12T18:49:50-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 18:49:51 2023-10-12T18:49:51-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 18:49:51 2023-10-12T18:49:51-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 18:49:51 2023-10-12T18:49:51-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 19:14:14 2023-10-12T19:14:14-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 19:14:14 2023-10-12T19:14:14-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 19:14:14 2023-10-12T19:14:14-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 19:14:15 2023-10-12T19:14:15-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 19:14:15 2023-10-12T19:14:15-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 19:14:15 2023-10-12T19:14:15-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 19:24:03 2023-10-12T19:24:03-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 19:24:03 2023-10-12T19:24:03-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 19:24:03 2023-10-12T19:24:03-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 19:24:04 2023-10-12T19:24:04-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 19:24:04 2023-10-12T19:24:04-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 19:24:04 2023-10-12T19:24:04-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 19:36:02 2023-10-12T19:36:02-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 19:36:02 2023-10-12T19:36:02-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 19:36:02 2023-10-12T19:36:02-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
2023-10-12 19:36:04 2023-10-12T19:36:04-07:00 [AUTH] INFO: Login by token. IP=[REDACTED]
2023-10-12 19:36:04 2023-10-12T19:36:04-07:00 [AUTH] INFO: Username from JWT: [REDACTED]
2023-10-12 19:36:04 2023-10-12T19:36:04-07:00 [AUTH] INFO: Successfully logged in user [REDACTED]. IP=[REDACTED]
louislam commented 1 year ago

Since there is no reproduce steps, changed to help.

According to your log, it looks like your browser kept disconnecting for some reason.

zluckytraveler commented 1 year ago
  • Try different browsers

I have tried using 3 different browsers including the private/incognito mode for each one as well, the result is still the same.

  • Reverse proxy or direct access?

I am using Cloudflare tunneling proxy, which was setup by following your guide.

I tried the demo, but was unable to reproduce the exact issue, although a similar issue did occur. aI did not setup anything within the demo, I simply created a login, accessed the dashboard, and that was it, nothing else.

I received the error notification, however the difference is the webpage is not automatically reloading after receiving the error, remaining static, and the error message has some extra context to it compared to what I have been receiving.

Using a Reverse Proxy? Check how to config it for WebSocket

Screenshot 2023-10-13 at 2 38 45 AM

I have websockets enabled for my domain within Cloudflare as well.

Screenshot 2023-10-13 at 2 55 44 AM
louislam commented 1 year ago

The demo site is currently no down time. Since you saw the error notification on the demo site, I suspect that there is some wired issue in your network.

I think they are same issue, because if the page does not auto reload, which means it is still reconnecting. It will reload once it is connected.

I would suggest you should try https://demo.uptime.kuma.pet/ on other networks such as your mobile phone with mobile network.

zluckytraveler commented 1 year ago

The page does not auto reload, which means it is still reconnecting. It will reload once it is connected.

The demo does not reload at all whatsoever, I had the page open for over an hour, and it never reconnected once, and just in case there was a limitation due to the 10 minute timer (because the demo doesn't end as expected), I had tried multiple times and not once did it ever reload. As with my environment the error pops ups only for a split second and the page reloads immediately.

I suspect that there is some wired issue in your network.

I used the same wifi network on my mobile device that my desktop is using, and I'm not experience this issue.

I would suggest you should try demo.uptime.kuma.pet on other networks such as your mobile phone

I have tried this and I was also unable to reproduce the issue.

chakflying commented 1 year ago

How many monitors do you have running? If the websocket was overloaded the connection would also get dropped.

zluckytraveler commented 1 year ago

@chakflying

How many monitors do you have running? If the websocket was overloaded the connection would also get dropped.

I currently have 88 monitors which includes groups, however this issue has been persistent for a very long time, going back to when I had easily less than 20 monitors running. Also keep in mind this issue is only happening for the dashboard, my status page works just fine.

If this was case, then wouldn't the issue persist on either any similar client or network that is the same?

I have another macOS desktop with far less features and hardware specifications than the one the issue is happening on and it doesn't occur. My iPhone is working just fine either with or without being on the same network too.

zluckytraveler commented 1 year ago

@louislam I haven't heard from you in a while. I'd like to be able to resolve this issue.

wc7086 commented 1 year ago

Maybe you should install a Windows in a VM to see if you can reproduce the problem?

zluckytraveler commented 1 year ago

Maybe you should install a Windows in a VM to see if you can reproduce the problem?

I have a Mac desktop, so I don’t think windows would be advisable.

Also this would require partitioning my drives in order to dual boot, which is something I’d really prefer not to do, as I’m not looking to lose any of my data.

wc7086 commented 1 year ago

I have a Mac desktop, so I don’t think windows would be advisable.

I was referring to installing Windows in a virtual machine such as vitualbox, if you can't reproduce the problem in a virtual machine this could indicate that some software in Macos is preventing the connection.

Also, you should check the logs or system logs of software that may be blocking the connection, and disconnections may not be related to uptime-kuma.

zluckytraveler commented 1 year ago

I was referring to installing Windows in a virtual machine such as vitualbox, if you can't reproduce the problem in a virtual machine this could indicate that some software in Macos is preventing the connection.

I've already tested using an alternative Mac desktop that is using the same OS version, where the issue is not present, so I'm not sure how doing this will differ or show anything significant.

You should check the logs or system logs of software that may be blocking the connection, and disconnections may not be related to uptime-kuma.

Sorry I wouldn't even know where to start, as I've never had to debug macOS before.

wc7086 commented 1 year ago

I've already tested using an alternative Mac desktop that is using the same OS version, where the issue is not present

One of the simplest solutions might be to back up your data and then reset your system.

louislam commented 1 year ago

I would suggest that you should rent a Linux server on DigitalOcean or Linode, and setup a Uptime Kuma on it, see if the issue is still existing.

These server providers can be paid hourly, less than US$0.01 per hour. It won't be expensive if you test a few day and you can shutdown them at anytime.

zluckytraveler commented 1 year ago

@louislam

I would suggest that you should rent a Linux server on DigitalOcean or Linode

I’m not sure how this would make a difference. As the issue persisted even with the demo, which means where or how it’s hosted isn’t a factor. Additionally uptime Kuma is already running on a Baremetal server, just macOS instead of Linux, and there’s no issues when accessing the dashboard on that server (localhost or domain) or any other device at all, whether they are on or off the same network as my home network. It’s only my personal Mac desktop at home I’m having this issue no matter the browser I use as well.

My Baremetal server that uptime Kuma is hosted on and my personal desktop are both macOS, both running the same OS version, and both using the same Safari version as well.

charlieporth1 commented 1 year ago

@zluckytraveler Are you using an ARM Mac? I have this same issue on Ubuntu 22.04 on an ARM64 Nvidia Jetson TX2. I'm running it in Docker though, which I want to note. But the same issue you're having. Which could be an ARM issue. You're comment on Additionally uptime Kuma is already running on a Baremetal server, just macOS instead of Linux is rather asinine if you knew what any of the differences were for example a fundamental part of any modern OS is the kernel which Mac OS uses the XNU kernel. Back peddling that Mac OS is based off of BSD. Peddling faster BSD is based off of UNIX. Forward pending Linux is not based off of UNIX instead is UNIX like

Other information

https://www.geeksforgeeks.org/linux-vs-unix/

louislam commented 1 year ago

If you have some basic coding skill, my another suggestion is you could try to build a very basic Socket.io app.

Following Step 1 and Step 3 should be able to create a working example. https://socket.io/docs/v4/tutorial/introduction

Just make sure your Socket.io client is connecting via websocket like this:

const socket = io("https://example.com", { transports: ["websocket"] });
jeygith commented 1 year ago

I've been experiencing the same issue.

Rolling back to version 1.22.0 seems to have fixed it.

louislam commented 1 year ago

I've been experiencing the same issue.

Rolling back to version 1.22.0 seems to have fixed it.

@jeygith Definitely not the same issue, as op has been experiencing 6+ months.

Please open a new issue with info and error logs.

jeygith commented 1 year ago

@louislam I've also experienced it for some time, but I didn't get time to look until today.

If the new issue won't be duplicating this, then I can open a new one.

github-actions[bot] commented 9 months ago

We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.

github-actions[bot] commented 9 months ago

This issue was closed because it has been stalled for 2 days with no activity.