bcdata_py icon indicating copy to clipboard operation
bcdata_py copied to clipboard

catch/report errors due to api service interruptions

Open smnorris opened this issue 1 year ago • 7 comments

See error at https://github.com/smnorris/bcfishpass/actions/runs/9815019608/job/27103503942

Same error with bcdata v0.10.2 and v0.10.4, as long as no cached response is present.

Something must have changed with the response?

smnorris avatar Jul 06 '24 00:07 smnorris

The error occurs when owslib parses the request, it isn't a bcdata function. owslib is pinned to 0.29.*, which has been available for some time - it shouldn't be a change to that that is causing the issue?

smnorris avatar Jul 06 '24 00:07 smnorris

looks to me like it is an error with the response, closing with hope that service is back up next week.

$ curl http://openmaps.gov.bc.ca/geo/pub/ows?service=WFS&request=Getcapabilities

 <?xml version="1.0" encoding="UTF-8"?><ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://openmaps.gov.bc.ca/geo/schemas/ows/1.1.0/owsAll.xsd">
  <ows:Exception exceptionCode="MissingParameterValue" locator="request">
    <ows:ExceptionText>Could not determine geoserver request from http request org.geoserver.monitor.MonitorServletRequest@6cc285b6</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

smnorris avatar Jul 06 '24 00:07 smnorris

Also noted here: https://github.com/bcgov/bcdata/issues/339. A similar workaround should be fine for users with known datasets - listing won't work.

smnorris avatar Jul 08 '24 16:07 smnorris

No, bcdata validates against the getcapabilities response, a workaround is not really practical.

smnorris avatar Jul 08 '24 16:07 smnorris

Service is back up!

smnorris avatar Jul 08 '24 17:07 smnorris

More informative error messages are the way to go:

  • [ ] catch the error when getCapabilities fails, add service interruption message, add test
  • [ ] look through the module to see if other api service interruptions can be caught

smnorris avatar Jul 08 '24 18:07 smnorris

Service is reported as up on the uptime page but is returning 502s fairly regularly. The retries work for the most part but I suspect depending on WFS during peak fire season is not advisable?

2024-07-22 16:30:15,821:WARNING:bcdata.wfs: HTTP error: 502
2024-07-22 16:30:15,821:WARNING:bcdata.wfs: Response headers: {'Date': 'Mon, 22 Jul 2024 23:29:43 GMT', 'Server': 'Apache', 'Content-Length': '341', 'Keep-Alive': 'timeout=5, max=100', 'Connection': 'Keep-Alive', 'Content-Type': 'text/html; charset=iso-8859-1'}
2024-07-22 16:30:15,821:WARNING:bcdata.wfs: Response text: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Proxy Error</title>
</head><body>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
The proxy server could not handle the request<p>Reason: <strong>Error reading from remote server</strong></p></p>
</body></html>

smnorris avatar Jul 22 '24 23:07 smnorris

Data caching will reduce errors from service interruptions. Closing for now

smnorris avatar Dec 11 '24 23:12 smnorris