sul-dlss / sul-embed

An oEmbed Service for Stanford University Libraries
Other
19 stars 6 forks source link

Geo viewer sidebar is not populated when GeoServer responds with an exception #2141

Open thatbudakguy opened 5 months ago

thatbudakguy commented 5 months ago

This might be specific to our testing setup, but tests that assert that the geo viewer sidebar can be opened to view feature information appear to be intermittently failing as of https://github.com/sul-dlss/sul-embed/commit/577f2e48f60d5d395688b45a99908bebf32f798d. Some earlier CI failures like https://github.com/sul-dlss/sul-embed/actions/runs/8602436918/job/23572000525 may be related.

The problem looks like the geo viewer javascript where we make the WMS request to GeoServer to get the feature info and insert it into the sidebar. Specifically, if GeoServer responds with a 200 but the data is an exception encoded as JSON, we bail out: https://github.com/sul-dlss/sul-embed/blob/577f2e48f60d5d395688b45a99908bebf32f798d/app/javascript/src/modules/geo_viewer.js#L164-L168

In my testing locally, I could trigger this codepath about 50% of the time, with no way of predicting whether or not it would happen. For whatever reason, GeoServer sometimes responds to the GetFeatureInfo request with an exception indicating it couldn't find this layer. I tried adding a retry method with backoff, but couldn't see it helping.

GeoServer's access logs on the server show it responding to each request, but don't give any hint as to what might be going wrong:

172.20.21.194 - - [22/Apr/2024:13:56:48 -0700] "GET /geoserver/wms/?LAYERS=druid%3Acz128vq0535&BBOX=25.7080078125%2C-3.3050503438610943%2C38.86962890625001%2C6.064086258846952&WIDTH=1198&HEIGHT=854&QUERY_LAYERS=druid%3Acz128vq0535&X=599&Y=427&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&STYLES=&SRS=EPSG%3A4326&EXCEPTIONS=application%2Fjson&INFO_FORMAT=application%2Fjson HTTP/1.1" 200 136 "http://127.0.0.1:63208/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/123.0.0.0 Safari/537.36"

The only potentially relevant thing I found online about this claims the issue was corrupted files in GeoServer's security directory: https://gis.stackexchange.com/questions/20726/intermittent-could-not-find-layer-and-bad-request-errors-on-geoserver