Repository navigation
Conversation
Author
|
Other PRs will hopefully render this moot by just speeding up the around filter's most egregious cases -- but in the interim, this is a stopgap that's hopefully easier to review/merge. That said, I don't know if this will actually help production in the near term. Two signs that would suggest it's helping (assuming the query mix is more or less consistent day to day):
I think grepping the log for |
cldellow
force-pushed
the
around-health-check
branch
from
November 24, 2026 18:59
546cd29 to
db29404
Compare
Author
|
Oops, the commits here aren't squashed yet. Will fix that up later tonight. |
The expensive around filters (filter_nodes_expensive, filter_ways_expensive, filter_relations_expensive) ran to completion before the next health check. A slow around therefore kept a CPU busy long after the query's [timeout:] had passed, only to fail with the timeout error once it finished. A Periodic_Health_Check now calls rman.health_check after every 64k units of work, so the query stops with the usual timeout error soon after its time is up. A unit is about one comparison of a candidate's point or segment with a point or segment of the input: is_inside on a way geometry now takes the check and ticks it for every point and segment it tests, also for the ways of candidate relations. Counting candidates alone isn't enough, because a single long way, such as a power line, tested against a large input can take seconds. Queries that finish within their limits return the same results as before. Co-Authored-By: Colin Dellow <cldellow@gmail.com>
cldellow
force-pushed
the
around-health-check
branch
from
November 24, 2026 19:57
db29404 to
bafc862
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Query timeouts are enforced after filters are applied:
Overpass-API/src/overpass_api/statements/query.cc
Lines 874 to 879 in c3a20c0
However, some filters can be quite expensive, depending on their inputs. The around filter is such an example.
This PR enforces timeouts more promptly by calling
health_checkperiodically during the around filter.health_checkitself is cheap and does not impact query runtime.On the Geofabrik Nova Scotia export, this query:
This PR: times out after 11 seconds with
runtime error: Query timed out in "query" at line 1 after 11 seconds.Current master: the timeout never fires. Instead, a backstop calculated here and enforced here fires after 80 seconds, and the
osm3s_queryprocess is killed.The backstop is 2*timeout + 60, so with the default timeout of 180 seconds, a query can run for an extra 4 minutes before being killed.
In all cases, such a delayed timeout would have eventually failed the query anyway. This change just causes it to fail sooner, so the CPU can be relinquished for useful work.