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

Support for Timeout on Updates #2821

Open
Aklakan opened this issue Nov 5, 2024 · 1 comment · May be fixed by #2822
Open

Support for Timeout on Updates #2821

Aklakan opened this issue Nov 5, 2024 · 1 comment · May be fixed by #2822
Labels

Comments

@Aklakan
Copy link
Contributor

Aklakan commented Nov 5, 2024

Version

5.3.0-SNAPSHOT

What happened?

The cancel signal in QueryExecDataset is only placed into the context when a timeout is configured.

However, in the case of manual invocations to QueryExec.abort() the cancel signal is not placed into the context.
This prevents functions to check the flag and possibly abort prematurely.

A use case is the query which uses the GeoSPARQL property function, which creates a cross product between all geometries (inside the property function) and returns all overlapping ones. @LorenzBuehmann has been working on a revised version that respects the cancel flag, however he noted that the flag is only available when timeouts have been configured, making it impossible to cancel externally using QueryExec.abort();

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT * WHERE {
  ?x geo:sfIntersects ?y
}

Update: This issue started out with the cancel signal not always placed into an query execution's context, which prevented handling cancellation inside of functions and property functions after a manual abort via QueryExec.abort(). However, while working on this issue, it turned out that it is reasonable to extend the scope of this issue to make it possible to abort update executions via updateExec.abort().

The reason is, that update executions reuse the query execution machinery, but the context configured for the the update request was not forwarded to the query execution. This would e.g. cause custom functions registered with the update execution's context to not be available during query execution. While working on resolving this issue, I revised the update execution machinery to properly set up the context with the cancel signal, configure remaining query timeouts and introduce an updateExec.abort() method.

On large datasets, using the query above as the core to materialize spatial intersections between all pairs of geometries may run indefinitely, and it is useful to protect e.g. a Fuseki server against accidental long running updates with a timeout.

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
INSERT {
  ?x <urn:intersectsWith> ?y # Custom materialization
}
WHERE {
  ?x geo:sfIntersects ?y # GeoSPARQL property function
}

Relevant output and stacktrace

No response

Are you interested in making a pull request?

Yes

@Aklakan Aklakan added the bug label Nov 5, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 5, 2024
@Aklakan Aklakan linked a pull request Nov 5, 2024 that will close this issue
3 tasks
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 5, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 6, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 6, 2024
@Aklakan
Copy link
Contributor Author

Aklakan commented Nov 6, 2024

As a sidenote, neither QueryProcessor nor UpdateExec currently provide an abort() method, which might be a useful thing to add - especially w.r.t. #2701 where it would be highly useful to be able to also abort running executions.

I'd say having the cancel signal (and contexts) correctly wired up is a first step (as proposed in this issues' corresponding PR), and further changes could be added in future PRs.

Aklakan added a commit to Aklakan/jena that referenced this issue Nov 10, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 11, 2024
@Aklakan Aklakan changed the title Cancel Signal unavailable without timeouts - breaks manual abort(). Support for Timeout on Updates Nov 11, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 13, 2024
Aklakan added a commit to Aklakan/jena that referenced this issue Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant