Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GeoFence rule removal more robust #12150

Closed
etj opened this issue Apr 11, 2024 · 0 comments · Fixed by #12151
Closed

Make GeoFence rule removal more robust #12150

etj opened this issue Apr 11, 2024 · 0 comments · Fixed by #12151
Assignees
Milestone

Comments

@etj
Copy link
Contributor

etj commented Apr 11, 2024

If GeoServer can not be reached during rule deletion, a returned None value is not properly handled:

[2024-04-11 09:15:54,091: ERROR/ForkPoolWorker-306] Error collecting rules for geonode:pat_po
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.10/http/client.py", line 1375, in getresponse
    response.begin()
  File "/usr/lib/python3.10/http/client.py", line 318, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.10/http/client.py", line 279, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.10/socket.py", line 705, in readinto
    return self._sock.recv_into(b)
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.10/dist-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 469, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 358, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='geoserver', port=8080): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/geonode/geoserver/geofence.py", line 292, in get_rules
    r = requests.get(
  File "/usr/local/lib/python3.10/dist-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 532, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='geoserver', port=8080): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/geonode/geoserver/geofence.py", line 413, in collect_delete_layer_rules
    gs_rules = self.geofence.get_rules(
  File "/usr/local/lib/python3.10/dist-packages/geonode/geoserver/geofence.py", line 307, in get_rules
    raise GeofenceException(f"Error while retrieving GeoFence rules: {e}")
geonode.geoserver.geofence.GeofenceException: Error while retrieving GeoFence rules: HTTPConnectionPool(host='geoserver', port=8080): Read timed out. (read timeout=30)
[2024-04-11 09:15:54,097: ERROR/ForkPoolWorker-306] Error removing rules for geonode:pat_po
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/geonode/geoserver/geofence.py", line 444, in delete_layer_rules
    logger.debug(f"Going to remove {batch.length()} rules for layer {workspace_name}:{layer_name}")
AttributeError: 'NoneType' object has no attribute 'length'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants