botamusique icon indicating copy to clipboard operation
botamusique copied to clipboard

Temporary internet connectivity loss causes botamusique to crash

Open Elinvention opened this issue 2 years ago • 2 comments

Describe the bug If the internet connection is unstable and it's not possible to resolve names, botamusique crashes and returns exit status 1.

Affected version 7.2.2

To Reproduce Steps to reproduce the behavior:

  1. start botamusique
  2. unplug ethernet cable
  3. botamusique crashes
  4. See error

Expected behavior Botamusique should wait for the network to be available again and keep trying to reconnect.

Desktop (please complete the following information): NixOS 22.05

Additional context Sorry for nix's hashes:

Started botamusique.service.
Network failure
Traceback (most recent call last):
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 33, in fetch_all_hosts
    data = socket.getaddrinfo(
  File "/nix/store/xpwwghl72bb7f48m51amvqiv1l25pa01-python3-3.9.13/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
Network failure
Traceback (most recent call last):
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 68, in fetch_hosts
    hosts = fetch_all_hosts()
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 33, in fetch_all_hosts
    data = socket.getaddrinfo(
  File "/nix/store/xpwwghl72bb7f48m51amvqiv1l25pa01-python3-3.9.13/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
Network failure
Traceback (most recent call last):
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 86, in pick_base_url
    names = fetch_hosts()
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 68, in fetch_hosts
    hosts = fetch_all_hosts()
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 33, in fetch_all_hosts
    data = socket.getaddrinfo(
  File "/nix/store/xpwwghl72bb7f48m51amvqiv1l25pa01-python3-3.9.13/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
Traceback (most recent call last):
  File "/nix/store/ymcvj1vrrazs5r54yga8s3qajhffjsn2-botamusique-7.2.2/share/botamusique/.mumbleBot.py-wrapped", line 26, in <module>
    import command
  File "/nix/store/ymcvj1vrrazs5r54yga8s3qajhffjsn2-botamusique-7.2.2/share/botamusique/command.py", line 14, in <module>
    from pyradios import RadioBrowser
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/__init__.py", line 3, in <module>
    from pyradios.radios import RadioBrowser
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/radios.py", line 29, in <module>
    class RadioBrowser:
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/radios.py", line 60, in RadioBrowser
    base_url = pick_base_url()
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 86, in pick_base_url
    names = fetch_hosts()
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 68, in fetch_hosts
    hosts = fetch_all_hosts()
  File "/nix/store/c0rj7pbjrkxcd2x09fzyyh2nx5is0agh-python3.9-pyradios-1.0.1/lib/python3.9/site-packages/pyradios/base_url.py", line 33, in fetch_all_hosts
    data = socket.getaddrinfo(
  File "/nix/store/xpwwghl72bb7f48m51amvqiv1l25pa01-python3-3.9.13/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
botamusique.service: Main process exited, code=exited, status=1/FAILURE
botamusique.service: Failed with result 'exit-code'.
botamusique.service: Consumed 1.421s CPU time, received 332B IP traffic, sent 332B IP traffic.
botamusique.service: Scheduled restart job, restart counter is at 15.

Elinvention avatar Jul 18 '22 16:07 Elinvention

There are many places in the code where the bot need internet access (radio list, youtube requests, youtube api, download, updates....). It's will be hard to fix all of them. Not sure we have the time to implement a re-try on all parts.

azlux avatar Jul 19 '22 15:07 azlux

edit your systemd service file to: restart=always, this way if it crashes at least it will come back up. Something like this;

[Unit] Description=botamusique - The murmur musicbot After=mumble-server.service

StartLimitBurst=3 StartLimitIntervalSec=30

[Service] Type=simple Restart=always RestartSec=10s

hamilton5 avatar Sep 01 '22 04:09 hamilton5