Error on map client search #338

Closed
opened 2023-06-28 09:43:39 +02:00 by mpeltriaux · 1 comment
Owner

Description

Under certain circumstances there is no response returned by the external address search component, which is used in the map client and proxied via konova itself. Thus resulting in an error

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)

During handling of the above exception (0), another exception occurred:
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/konova/konova/views/map_proxy.py", line 30, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/konova/konova/views/map_proxy.py", line 60, in get
    body = json.loads(content)
  File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

Exception Type: JSONDecodeError at /client/proxy Exception Value: Expecting value: line 1 column 1 (char 0) Request information:

It is obvious from raise JSONDecodeError("Expecting value", s, err.value) from None that None seems to be returned in some cases. This results in no result displays on the client without further info for the user and an error mail each time this error happens.

Enhancement

  1. Catch this error and give it a proper handling
  2. Instead of returning nothing in response, think about returning a dummy response, which - in fact - holds an explanation of what is happening. So the user will receive not a set of results to choose from but instead a 1 element result set holding the info that something is not working as expected and they shall try this function in a few seconds again.

Limitation

Since the main cause of this problem comes from the external service, which is located at LVermGeo, we can not directly optimize nor fix any further behaviour.

# Description Under certain circumstances there is no response returned by the external address search component, which is used in the map client and proxied via konova itself. Thus resulting in an error ```python Traceback (most recent call last): File "/usr/local/lib/python3.7/json/decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) During handling of the above exception (0), another exception occurred: File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.7/site-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view return view_func(request, *args, **kwargs) File "/konova/konova/views/map_proxy.py", line 30, in dispatch return super().dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.7/site-packages/django/views/generic/base.py", line 98, in dispatch return handler(request, *args, **kwargs) File "/konova/konova/views/map_proxy.py", line 60, in get body = json.loads(content) File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None Exception Type: JSONDecodeError at /client/proxy Exception Value: Expecting value: line 1 column 1 (char 0) Request information: ``` It is obvious from ` raise JSONDecodeError("Expecting value", s, err.value) from None` that `None` seems to be returned in some cases. This results in no result displays on the client without further info for the user and an error mail each time this error happens. # Enhancement 1. Catch this error and give it a proper handling 1. Instead of returning nothing in response, think about returning a dummy response, which - in fact - holds an explanation of what is happening. So the user will receive not a set of results to choose from but instead a 1 element result set holding the info that something is not working as expected and they shall try this function in a few seconds again. ## Limitation Since the main cause of this problem comes from the external service, which is located at LVermGeo, we can not directly optimize nor fix any further behaviour.
mpeltriaux added the
bug
label 2023-06-28 09:43:39 +02:00
mpeltriaux self-assigned this 2023-06-28 09:43:39 +02:00
Author
Owner

Merged in #340

# Merged in #340
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: IT-Naturschutz/konova#338
No description provided.