Aklakan commented on issue #3837:
URL: https://github.com/apache/jena/issues/3837#issuecomment-4205537791

   > The outer requests are being canceled by the client, but the inner SERVICE 
subqueries
   continue to run. After enough of these, the target dataset stops responding 
to even direct
   queries.
   
   If I understand the problem correctly, then the issue is, that cancellation 
is not forwarded to a SERVICE execution, and the requests just keep piling up.
   Service execution materializes the result sets before returning - 
cancellation only kicks in after materialization completes. Especially when 
doing `?s ?p ?o`, executions will likely pile up.
   However, setting `arq:httpQueryTimeout` in the Fuseki endpoint context 
*should* have an effect for HTTP SERVICE requests (based on the code).
   
   *Might* work also work with the CLI tooling: (not tested)
   ```
   # Whichever tool you are using
   ./rsparql --set 'arq:httpQueryTimeout=1000' ...
   ./tdb2-query --set `arq:httpQueryTimeout=1000` --set 'arq:queryTimeout=2000'
   # Note: queryTimeout should affect the outer query, httpQueryTimeout the 
inner.
   ```
   
   Relevant code in `Service.java`
   ```java
       public static QueryIterator exec(OpService op, Context context) {
   /...
           long timeoutMillis = timeoutFromContext(context);
   
           // RegistryServiceModifier is applied by QueryExecHTTP
           Params serviceParams = getServiceParamsFromContext(serviceURL, 
context);
   
           // Build the execution
           try (QueryExecHTTP qExec = QueryExecHTTP.newBuilder()
                   .endpoint(serviceURL)
                   .timeout(timeoutMillis, TimeUnit.MILLISECONDS)
                   .httpHeader(HttpNames.hUserAgent, HttpEnv.UserAgent)
                   .query(query)
                   .params(serviceParams)
                   .context(context)
                   .httpClient(httpClient)
                   .sendMode(querySendMode)
                   .build()) {
   
               // Detach from the network stream.
               RowSet rowSet = qExec.select().materialize();
               QueryIterator qIter = QueryIterPlainWrapper.create(rowSet);
               if (requiresRemapping)
                   qIter = QueryIter.map(qIter, varMapping);
               return qIter;
           } catch (HttpException ex) {
               throw QueryExceptionHTTP.rewrap(ex);
           }
   // ...
   }
   // ---------------
       /*package*/ static long timeoutFromContext(Context context) {
           return parseTimeout(context.get(httpQueryTimeout));
       }
   
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to