Occasional hanging on external podcasts
I'm seeing intermittent hanging on the podcasts screen for RSS podcasts where it looks as though images are trying to load and failing. The failure isn't such a problem, however it can cause the entire session to freeze up. Navigating back to the browse page brings back no recent items and a refresh needs to be performed in order to get back. Below are some snippets of a stack trace
Steps to reproduce
- Visit a channel
- Wait for cropped images to load
- When these fail, try to interact with the app as normal
What happens?
Calls to the API are not made (e.g. recently listened songs, favourites etc). Some parts of the app simply won't load (usually the channels page) and a forceful refresh can sometimes lead to a 503 (I haven't got a stack trace for this)
What is expected?
If images fail to load, this should happen silently and with no further impact
Context
Funkwhale version(s) affected: 0.21-rc1+git.0a26fceb
- Firefox 75, Chromium 81, Chrome 81 (Android)
- Docker multi-container with nginx
API logs
api_1 | 2020-04-19 23:34:45,223 versatileimagefield.image_warmer ERROR Thumbnail generation failed
api_1 | Traceback (most recent call last):
api_1 | File "/venv/lib/python3.7/site-packages/versatileimagefield/image_warmer.py", line 114, in _prewarm_versatileimagefield
api_1 | url = get_url_from_image_key(versatileimagefieldfile, size_key)
api_1 | File "/venv/lib/python3.7/site-packages/versatileimagefield/utils.py", line 196, in get_url_from_image_key
api_1 | img_url = img_url[size_key].url
api_1 | File "/venv/lib/python3.7/site-packages/versatileimagefield/datastructures/sizedimage.py", line 145, in __getitem__
api_1 | height=height
api_1 | File "/venv/lib/python3.7/site-packages/versatileimagefield/datastructures/sizedimage.py", line 197, in create_resized_image
api_1 | path_to_image
api_1 | File "/venv/lib/python3.7/site-packages/versatileimagefield/datastructures/base.py", line 139, in retrieve_image
api_1 | image_format, mime_type = get_image_metadata_from_file(image)
api_1 | File "/venv/lib/python3.7/site-packages/versatileimagefield/utils.py", line 152, in get_image_metadata_from_file
api_1 | image_format = MIME_TYPE_TO_PIL_IDENTIFIER[mime_type]
api_1 | KeyError: 'application/json'
api_1 | 2020-04-19 23:40:18,620 django.request ERROR Internal Server Error: /api/v1/attachments/5bd36f5c-d38d-44b9-8220-746775d2f8cc/proxy
api_1 | Traceback (most recent call last):
api_1 | File "/venv/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 313, in recv_into
api_1 | return self.connection.recv_into(*args, **kwargs)
api_1 | File "/venv/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1840, in recv_into
api_1 | self._raise_ssl_error(self._ssl, result)
api_1 | File "/venv/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1663, in _raise_ssl_error
api_1 | raise SysCallError(errno, errorcode.get(errno))
api_1 | OpenSSL.SSL.SysCallError: (104, 'ECONNRESET')
api_1 | During handling of the above exception, another exception occurred:
api_1 |
api_1 | Traceback (most recent call last):
api_1 | File "/venv/lib/python3.7/site-packages/urllib3/response.py", line 425, in _error_catcher
api_1 | yield
api_1 | File "/venv/lib/python3.7/site-packages/urllib3/response.py", line 507, in read
api_1 | data = self._fp.read(amt) if not fp_closed else b""
api_1 | File "/usr/lib/python3.7/http/client.py", line 457, in read
api_1 | n = self.readinto(b)
api_1 | File "/usr/lib/python3.7/http/client.py", line 501, in readinto
api_1 | n = self.fp.readinto(b)
api_1 | File "/usr/lib/python3.7/socket.py", line 589, in readinto
api_1 | return self._sock.recv_into(b)
api_1 | File "/venv/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 318, in recv_into
api_1 | raise SocketError(str(e))
api_1 | OSError: (104, 'ECONNRESET')
api_1 |
api_1 | During handling of the above exception, another exception occurred:
api_1 |
api_1 | Traceback (most recent call last):
api_1 | File "/venv/lib/python3.7/site-packages/requests/models.py", line 751, in generate
api_1 | for chunk in self.raw.stream(chunk_size, decode_content=True):
api_1 | File "/venv/lib/python3.7/site-packages/urllib3/response.py", line 564, in stream
api_1 | data = self.read(amt=amt, decode_content=decode_content)
api_1 | File "/venv/lib/python3.7/site-packages/urllib3/response.py", line 529, in read
api_1 | raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
api_1 | File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
api_1 | self.gen.throw(type, value, traceback)
api_1 | File "/venv/lib/python3.7/site-packages/urllib3/response.py", line 443, in _error_catcher
api_1 | raise ProtocolError("Connection broken: %r" % e, e)
api_1 | urllib3.exceptions.ProtocolError: ('Connection broken: OSError("(104, \'ECONNRESET\')")', OSError("(104, 'ECONNRESET')"))
api_1 |
api_1 | During handling of the above exception, another exception occurred:
api_1 |
api_1 | Traceback (most recent call last):
api_1 | File "/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
api_1 | response = get_response(request)
api_1 | File "/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
api_1 | response = self.process_exception_by_middleware(e, request)
api_1 | File "/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
api_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
api_1 | File "/usr/lib/python3.7/contextlib.py", line 74, in inner
api_1 | return func(*args, **kwds)
api_1 | File "/venv/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
api_1 | return view_func(*args, **kwargs)
api_1 | File "/venv/lib/python3.7/site-packages/rest_framework/viewsets.py", line 114, in view
api_1 | return self.dispatch(request, *args, **kwargs)
api_1 | File "/venv/lib/python3.7/site-packages/rest_framework/views.py", line 505, in dispatch
api_1 | response = self.handle_exception(exc)
api_1 | File "/venv/lib/python3.7/site-packages/rest_framework/views.py", line 465, in handle_exception
api_1 | self.raise_uncaught_exception(exc)
api_1 | File "/venv/lib/python3.7/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
api_1 | raise exc
api_1 | File "/venv/lib/python3.7/site-packages/rest_framework/views.py", line 502, in dispatch
api_1 | response = handler(request, *args, **kwargs)
api_1 | File "/usr/lib/python3.7/contextlib.py", line 74, in inner
api_1 | return func(*args, **kwds)
api_1 | File "/app/funkwhale_api/common/views.py", line 175, in proxy
api_1 | tasks.fetch_remote_attachment(instance)
api_1 | File "/app/funkwhale_api/common/tasks.py", line 80, in fetch_remote_attachment
api_1 | for chunk in r.iter_content():
api_1 | File "/venv/lib/python3.7/site-packages/requests/models.py", line 754, in generate
api_1 | raise ChunkedEncodingError(e)
api_1 | requests.exceptions.ChunkedEncodingError: ('Connection broken: OSError("(104, \'ECONNRESET\')")', OSError("(104, 'ECONNRESET')"))