rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.12k stars 334 forks source link

WebSocket Error #303

Open leabdd opened 1 year ago

leabdd commented 1 year ago

Describe the bug

The Bug I am having is that the Miner loses connection every now and then, I can only resolve this error with a restart of the Docker Container. Else it will just loop like this image

Steps to reproduce

I dont know what causes this bug and I cant reproduce it myself, to me it seems to happen randomly

Edit: found one way to consistently reproduce the it:

  1. Have the script running
  2. Receive a new Public IP for your Router
  3. Script doesn't recover itself

Expected behavior

Not losing connection or reconnecting if it lost connection.

Operating system

Raspberry Pi OS

Python version

3.11.4

Miner version

1.8.3

Other relevant software versions

No response

Logs

Apologize for not having a "less" version available. I only took out about 200 Lines of the Log because this went on for the entire morning until I saw it. The lines are the first time it happened and then once I noticed it and stopped the Container: https://gist.github.com/leabdd/a2da8f116340efc76063a4564ff18730

Additional context

No response

rdavydov commented 1 year ago

Obviously, a connection issue in your container/with your ISP/with your hardware.

Can you try it with a different ISP/hardware? For example, run it on your PC for a day, instead of the RPi.

leabdd commented 1 year ago

Obviously, a connection issue in your container/with your ISP/with your hardware.

That could very possibly be since my internet connection is currently, due to a buggy router firmware, cutting off sometimes, but recovers itself within a few minutes.

And as I just saw, thank you for the user issue... Shouldnt your Code be able to recover itself from a connection issue instead of just spitting out this error for hours even tho the internet connection is available?

If I look at the Logs it even seems to try reconnecting a receiving "Pong" multiple times, but then suddenly gets an error again and closes the Websocket. If you would look from Line 128 until 153 for example

rdavydov commented 1 year ago

It has a connection recovery mechanism, but not for such unusual strange cases.

I've made an experiment just now, turned off the connection several times while running the miner and it reconnected successfully without any problems.

You should fix your router.

Veatra commented 1 year ago

i got this issue aswell after i lost internet (or getting like 80 % packet lost) for an hour or two, even with my internet beeing full functional again, it still looped like this for hours, unless i restart the script

leabdd commented 1 year ago

Found a way to reproduce my issue, in the case of a connection loss, which I thought was the issue, it recovers itself. I have looked through the routers Logs for that and it seems to happen, not only, but consistently when my public IP changes, then the issue appears and doesn't resolve until the restart.

So how to reproduce?

  1. Have the script running
  2. Receive a new Public IP for your Router
  3. Script doesn't recover itself
Veatra commented 1 year ago

i guess thats it was also happend in my case, my ip only changes if my internet is out for a longer period of time

goldjee commented 1 year ago

Same problem happens on my rig. The script goes unresponsive even for ctrl+c in terminal. It says something like "ctrl+c detected, please wait" and continues trying to reconnect like I haven't tried to stop it.

Probably, a decent solution would be to introduce MAX_RECONNECT_ATTEMPTS parameter in config so the script would not end up in an infinite loop. Also, possibly there is a problem handling SIGINT somewhere in the script.

rdavydov commented 1 year ago

@goldjee good thing would be to include DEBUG logs to support your statements.

rdavydov commented 1 year ago

IP change definitely can be the case, need to analyze this situation and think of a workaround.

goldjee commented 1 year ago

@rdavydov no worries, here are some logs and my terminal output for the same timespan. SIGINT was issued at 06/07/23 10:52:34 and the script continued to carry on.

Hope this information will help to clarify the issue.

logs.txt terminal_output.txt

larryxs commented 10 months ago

You can set value from False to True at "disable_ssl_cert_verification" in the config what you are using for run.