Closed tyrasd closed 4 years ago
I tested it locally by starting the ohsome API in eclipse for the request http://localhost:8080/elements/geometry?bboxes=-180,-90,180,90&timeout=1
(using a local H2 oshdb database file). There, the error is not reproducible. In my case I get an HTTP/200 status and in the returned json content an error message 413, which is how it should be.
{
"attribution": {
"url": "https://ohsome.org/copyrights",
"text": "© OpenStreetMap contributors"
},
"apiVersion": "1.0.0-SNAPSHOT",
"type": "FeatureCollection",
"features": [
{
"timestamp": "2020-07-01T10:07:45.635474",
"status": 413,
"message": "The given query is too large in respect to the given timeout. Please use a smaller region and/or coarser time period.",
"requestUrl": "http://localhost:8080/elements/geometry?bboxes=-180,-90,180,90&timeout=1"
}
But this seems to be only the behaviour when using a local H2 oshdb file, since the problem is easily reproducible in swagger: I tested in swagger smaller bboxes and I got back arbitrarily 500 and 413 errors with bboxes of sizes ranging between about 1 and 4 (e.g. -3,-1.5,3,1.5).
https://api.ohsome.org/v1/elements/geometry?bboxes=-3,-1.5,3,1.5&timeout=1
Note: This issue was closed automatically because the causing bug was fixed in the oshdb 0.6-SNAPSHOT (master branch). Once it gets into an OSHDB release and this is pulled in from the ohsome-api, it will finally also fix this bug here.
When using a relatively short timeout with a data extraction request and the timeout hits before the first chunk of data was sent, the result is a HTTP/500 error code (internal server error) instead of a 4xx error code (invalid request, e.g. 413 like it is thrown by the data aggregation endpoints).
Also the error description is not very useful in this case:
As far as I can see in the logs, the correct
OSHDBTimeoutException
is thrown, but not properly catched and handled by the ohsome API.