ham-radio-software / D-Rats

D-Rats program for D-Star Ham Radios
https://iz2lxi.jimdofree.com/
Other
43 stars 13 forks source link

MacOs - D-Rats get stuck while rendering map #185

Open maurizioandreotti opened 1 year ago

maurizioandreotti commented 1 year ago

while rendering the outdoor map i got stuck, with D-Rats completely not responding to any command

image

maps were working, but at some point something happened and the map got frozen and in console i got a number of these errors:

Traceback (most recent call last):
    raise MapTileNotFound(str(err.reason))
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
OSError: [Errno 24] Too many open files: '/Users/maurizio/.d-rats-ev/maps/landscape/14/4777/6200.bad'
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 503, in fetch
d_rats.map.maptile.MapTileNotFound: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    self.connect()
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/http/client.py", line 1448, in connect
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.fetch_url(url, self._local_path())
    super().connect()
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/http/client.py", line 942, in connect
    self.run()
    self.run()
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 975, in run
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 519, in open
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 559, in fetch_url
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 589, in _thread
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 536, in _open
    self.sock = self._create_connection(
    self._target(*self._args, **self._kwargs)
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 589, in _thread
    if self.fetch():
       ^^^^^^^^^^^^
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 512, in fetch
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/socket.py", line 827, in create_connection
    if self.fetch():
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 496, in _call_chain
       ^^^^^^^^^^^^
    with open(self._local_bad_path(), 'w'):
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 512, in fetch
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 24] Too many open files: '/Users/maurizio/.d-rats-ev/maps/landscape/14/4778/6199.bad'
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/socket.py", line 962, in getaddrinfo
OSError: [Errno 24] Too many open files: '/Users/maurizio/.d-rats-ev/maps/landscape/14/4778/6204.bad'
    raise MapTileNotFound(str(err.reason))
    result = func(*args)
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
d_rats.map.maptile.MapTileNotFound: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
             ^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 1391, in https_open
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 550, in fetch_url
    return self.do_open(http.client.HTTPSConnection, req,
    self.run()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 1351, in do_open
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 975, in run
    data = urllib.request.urlopen(req)
urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 503, in fetch
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 216, in urlopen
    self._target(*self._args, **self._kwargs)
    return opener.open(url, data, timeout)
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 589, in _thread
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 519, in open
    self.fetch_url(url, self._local_path())
    if self.fetch():
       ^^^^^^^^^^^^
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 512, in fetch
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 559, in fetch_url
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 536, in _open
    with open(self._local_bad_path(), 'w'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 24] Too many open files: '/Users/maurizio/.d-rats-ev/maps/landscape/14/4779/6204.bad'
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 496, in _call_chain
    raise MapTileNotFound(str(err.reason))
d_rats.map.maptile.MapTileNotFound: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
    result = func(*args)
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 589, in _thread
             ^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 1391, in https_open
    if self.fetch():
       ^^^^^^^^^^^^
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/urllib/request.py", line 1351, in do_open
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 512, in fetch
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 503, in fetch
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 559, in fetch_url
    with open(self._local_bad_path(), 'w'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 24] Too many open files: '/Users/maurizio/.d-rats-ev/maps/landscape/14/4779/6200.bad'
d_rats.map.maptile.MapTileNotFound: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/Users/maurizio/.asdf/installs/python/3.11.3/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 589, in _thread
    if self.fetch():
       ^^^^^^^^^^^^
  File "/Users/maurizio/Virtualenvs/d-rats4/D-Rats-wb8tyw_bugfix146/d_rats/map/maptile.py", line 512, in fetch
    with open(self._local_bad_path(), 'w'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 24] Too many open files: '/Users/maurizio/.d-rats-ev/maps/landscape/14/4779/6203.bad'
04/21/2023 18:05:48:INFO:RPCSession:worker: Cancelling job 1 due to timeout
04/21/2023 18:05:58:INFO:MapTile:fetch: created /Users/maurizio/.d-rats-ev/maps/landscape/14/8621/5840.bad
04/21/2023 18:05:58:INFO:MapTile:fetch: [0] Not fetched `https://tile.thunderforest.com/landscape/14/8621/5840.png?apikey=5a1a4a79354244a38707d83969fd88a1': [Errno 8] nodename nor servname provided, or not known
04/21/2023 18:05:58:INFO:MapTile:fetch: created /Users/maurizio/.d-rats-ev/maps/landscape/14/8625/5841.bad
04/21/2023 18:05:58:INFO:MapTile:fetch: [0] Not fetched `https://tile.thunderforest.com/landscape/14/8625/5841.png?apikey=5a1a4a79354244a38707d83969fd88a1': [Errno 8] nodename nor servname provided, or not known
04/21/2023 18:05:58:INFO:MapTile:fetch: created /Users/maurizio/.d-rats-ev/maps/landscape/14/8619/5840.bad
04/21/2023 18:05:58:INFO:MapTile:fetch: [0] Not fetched `https://tile.thunderforest.com/landscape/14/8619/5840.png?apikey=5a1a4a79354244a38707d83969fd88a1': [Errno 8] nodename nor servname provided, or not known
04/21/2023 18:06:06:INFO:MapTile:fetch: created /Users/maurizio/.d-rats-ev/maps/landscape/14/4776/6199.bad
04/21/2023 18:06:06:INFO:MapTile:fetch: [0] Not fetched `https://tile.thunderforest.com/landscape/14/4776/6199.png?apikey=5a1a4a79354244a38707d83969fd88a1': [Errno 8] nodename nor servname provided, or not known
04/21/2023 18:06:06:INFO:MapTile:fetch: created /Users/maurizio/.d-rats-ev/maps/landscape/14/4779/6197.bad
04/21/2023 18:06:06:INFO:MapTile:fetch: [0] Not fetched `https://tile.thunderforest.com/landscape/14/4779/6197.png?apikey=5a1a4a79354244a38707d83969fd88a1': [Errno 8] nodename nor servname provided, or not known
wb8tyw commented 1 year ago

Two issues are showing up in the traceback reports. The first is that urllib is claiming that the the DNS resolution is failing for the map server. That could be a temporary network condition. We need to handle that error better to avoid the traceback. About the only thing we can do is wait for a while and retry later, or give up and report to the user. For the give up, the only control we have for the user to restart the tries is currently to change the zoom level.

The second issue is: https://github.com/ham-radio-software/D-Rats/issues/133 where we just try to run infinite downloads in parallel. We do not cancel downloads for tiles for zoom levels that we are no longer at.