ubopod / ubo_app

This repo contains code for Ubo system app to control Raspberry Pi utilities and Ubo based functionalities
6 stars 2 forks source link

ubo app crashes after it remains open for a day or so #101

Closed zytegalaxy closed 2 months ago

zytegalaxy commented 2 months ago

issue: ubo app crashes after it remains open for a day or so. version 0.14.1 - lite See crash log below

socket.gaierror: [Errno -3] Temporary failure in name resolution

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/store/update_manager/utils.py", line 44, in check_version
    async with (
  File "/opt/ubo/env/lib/python3.11/site-packages/aiohttp/client.py", line 1197, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/aiohttp/client.py", line 581, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/aiohttp/connector.py", line 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host pypi.org:443 ssl:default [Temporary failure in name resolution]
1710515356.221455 [ERROR] Task failed
Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/utils/async_.py", line 44, in wrapper
    await awaitable
RuntimeError: Task <Task pending name='Task-36' coro=<create_task.<locals>.wrapper() running at /opt/ubo/env/lib/python3.11/site-packages/ubo_app/utils/async_.py:44>> got Future <_GatheringFuture pending> attached to a different loop - extra: {
  "awaitable": "<_GatheringFuture pending>"
}
1710515357.365819 [INFO] No internet connection, showing WiFi onboarding.
1710515357.549515 [ERROR] Task failed
Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/utils/async_.py", line 44, in wrapper
    await awaitable
RuntimeError: Task <Task pending name='Task-65' coro=<create_task.<locals>.wrapper() running at /opt/ubo/env/lib/python3.11/site-packages/ubo_app/utils/async_.py:44>> got Future <_GatheringFuture pending> attached to a different loop - extra: {
  "awaitable": "<_GatheringFuture pending>"
}
1710515361.448124 [ERROR] Not able to connect to pulseaudio
Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/000-sound/audio_manager.py", line 62, in initialize_audio
    with pulsectl.Pulse('set-default-sink') as pulse:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/pulsectl/pulsectl.py", line 380, in __init__
    try: self.connect(autospawn=True)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/pulsectl/pulsectl.py", line 443, in connect
    if self.connected is False: raise PulseError('Failed to connect to pulseaudio server')
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pulsectl.pulsectl.PulseError: Failed to connect to pulseaudio server
1710515520.412502 [INFO] Opening audio file for playback - extra: {
  "filename_": "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/000-sound/sounds/done.wav"
}
1710515544.813127 [INFO] Wireless connection created - extra: {
  "hidden": false,
  "ssid": "The Office",
  "type": "WPA"
}
1710515544.824912 [INFO] Opening audio file for playback - extra: {
  "filename_": "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/000-sound/sounds/add.wav"
}
1715195330.094543 [ERROR] Image not found
Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/docker/api/client.py", line 265, in _raise_for_status
    response.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http+docker://localhost/v1.45/images/ngrok/ngrok:latest/json

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/080-docker/image.py", line 163, in act
    image = docker_client.images.get(path)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/docker/models/images.py", line 333, in get
    return self.prepare_model(self.client.api.inspect_image(name))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/docker/api/image.py", line 251, in inspect_image
    return self._result(
           ^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/docker/api/client.py", line 271, in _result
    self._raise_for_status(response)
  File "/opt/ubo/env/lib/python3.11/site-packages/docker/api/client.py", line 267, in _raise_for_status
    raise create_api_error_from_http_exception(e) from e
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation) from e
docker.errors.ImageNotFound: 404 Client Error for http+docker://localhost/v1.45/images/ngrok/ngrok:latest/json: Not Found ("No such image: ngrok/ngrok:latest") - extra: {
  "image": "ngrok",
  "path": "ngrok/ngrok:latest"
}
1715195963.155264 [INFO] Opening audio file for playback - extra: {
  "filename_": "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/000-sound/sounds/done.wav"
}
1715196182.727746 [INFO] Opening audio file for playback - extra: {
  "filename_": "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/000-sound/sounds/done.wav"
}
1715196406.472358 [INFO] Opening audio file for playback - extra: {
  "filename_": "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/000-sound/sounds/done.wav"
}
1715197310.527657 [ERROR] Event loop exception
Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/050-vscode/ubo_handle.py", line 15, in setup
    await init_service()
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/050-vscode/setup.py", line 183, in init_service
    await check_status()
  File "/opt/ubo/env/lib/python3.11/site-packages/debouncer/debounce.py", line 201, in wrapper_
    return await _leading_edge(state, state.last_call_time)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/debouncer/debounce.py", line 71, in _leading_edge
    return await _invoke_func(state, time) if state.leading else state.result
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/debouncer/debounce.py", line 126, in _invoke_func
    state.result = await func(
                   ^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/050-vscode/checks.py", line 48, in check_status
    process = await asyncio.create_subprocess_exec(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/subprocess.py", line 218, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 1694, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/unix_events.py", line 207, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/usr/lib/python3.11/asyncio/unix_events.py", line 810, in _start
    self._proc = subprocess.Popen(
                 ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1901, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 26] Text file busy: '/opt/ubo/code' - extra: {
  "error_message": "Task exception was never retrieved",
  "future": "<Task finished name='Setup task for VSCode' coro=<setup() done, defined at /opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/050-vscode/ubo_handle.py:10> exception=OSError(26, 'Text file busy')>",
  "loop": "<_UnixSelectorEventLoop running=True closed=False debug=False>"
}
1715219726.654837 [INFO] Opening audio file for playback - extra: {
  "filename_": "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/000-sound/sounds/done.wav"
}
1715230885.120120 [ERROR] An error occurred while running the app.
Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/main.py", line 79, in main
    app.run()
  File "/opt/ubo/env/lib/python3.11/site-packages/kivy/app.py", line 956, in run
    runTouchApp()
  File "/opt/ubo/env/lib/python3.11/site-packages/kivy/base.py", line 574, in runTouchApp
    EventLoop.mainloop()
  File "/opt/ubo/env/lib/python3.11/site-packages/kivy/base.py", line 339, in mainloop
    self.idle()
  File "/opt/ubo/env/lib/python3.11/site-packages/kivy/base.py", line 379, in idle
    Clock.tick()
  File "/opt/ubo/env/lib/python3.11/site-packages/kivy/clock.py", line 733, in tick
    self.post_idle(ts, self.idle())
  File "/opt/ubo/env/lib/python3.11/site-packages/kivy/clock.py", line 776, in post_idle
    self._process_events()
  File "kivy/_clock.pyx", line 620, in kivy._clock.CyClockBase._process_events
  File "kivy/_clock.pyx", line 653, in kivy._clock.CyClockBase._process_events
  File "kivy/_clock.pyx", line 649, in kivy._clock.CyClockBase._process_events
  File "kivy/_clock.pyx", line 218, in kivy._clock.ClockEvent.tick
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/menu_app/home_page.py", line 64, in set_value
    gauge.value = psutil.cpu_percent(percpu=False)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/psutil/__init__.py", line 1817, in cpu_percent
    _last_cpu_times[tid] = cpu_times()
                           ^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/psutil/__init__.py", line 1681, in cpu_times
    return _psplatform.cpu_times()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/psutil/_pslinux.py", line 621, in cpu_times
    with open_binary('%s/stat' % procfs_path) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/psutil/_common.py", line 788, in open_binary
OSError: [Errno 24] Too many open files: '/proc/stat'
1715230885.353613 [ERROR] Event loop exception
Traceback (most recent call last):
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/030-ip/ubo_handle.py", line 15, in setup
    await init_service()
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/030-ip/setup.py", line 126, in init_service
    await check_connection()
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/030-ip/setup.py", line 84, in check_connection
    load_ip_addresses()
  File "/opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/030-ip/setup.py", line 58, in load_ip_addresses
    for interface_name, ip_addresses in psutil.net_if_addrs().items():
                                        ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ubo/env/lib/python3.11/site-packages/psutil/__init__.py", line 2235, in net_if_addrs
    rawlist = _psplatform.net_if_addrs()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 24] Too many open files - extra: {
  "error_message": "Task exception was never retrieved",
  "future": "<Task finished name='Setup task for IP' coro=<setup() done, defined at /opt/ubo/env/lib/python3.11/site-packages/ubo_app/services/030-ip/ubo_handle.py:10> exception=OSError(24, 'Too many open files')>",
  "loop": "<_UnixSelectorEventLoop running=True closed=False debug=False>"
}