Skip to content

QueryBatcher never stops when call to get URIs fails #1327

Closed
@ralfhergert

Description

@ralfhergert

We are trying to execute a long running query using withConsistentSnapshot=true. Depending on the configuration of our ML-DB the QueryBatcher may recieve a server error, as soon as the ML-DB is no longer capable of providing the snapshot. That is not an issue. But what is a problem for us is, that the exception thrown in

try (UrisHandle results = queryMgr.uris(queryMethod, query, filtered, handle, start, afterUri, forest.getForestName())) {
slips by "unnoticed". Meaning:

  • the QueryBatcher does not stop itself and still considers itself as working/running
  • no FailureListener attached to the QueryBatcher is called
  • the exception is just logged
    This is how the log messages looks like, when all worker threads are dying due to a server-side error:
Exception in thread "pool-11-thread-1" com.marklogic.client.FailedRequestException: Local message: failed to apply resource at internal/uris: Internal Server Error. Server Message: Server (not a REST instance?) did not respond with an expected REST Error message.
at com.marklogic.client.impl.OkHttpServices.checkStatus(OkHttpServices.java:4449)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3382)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3438)
at com.marklogic.client.impl.QueryManagerImpl.uris(QueryManagerImpl.java:169)
at com.marklogic.client.impl.OkHttpServices.uris(OkHttpServices.java:3030)
at com.marklogic.client.datamovement.impl.QueryBatcherImpl$QueryTask.run(QueryBatcherImpl.java:738)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3373)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.marklogic.client.impl.OkHttpServices.processQuery(OkHttpServices.java:3130)
at java.base/java.lang.Thread.run(Unknown Source)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3373)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at com.marklogic.client.impl.OkHttpServices.processQuery(OkHttpServices.java:3130)
at com.marklogic.client.datamovement.impl.QueryBatcherImpl$QueryTask.run(QueryBatcherImpl.java:738)
at java.base/java.lang.Thread.run(Unknown Source)
at com.marklogic.client.impl.OkHttpServices.checkStatus(OkHttpServices.java:4449)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3382)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
Exception in thread "pool-11-thread-2" com.marklogic.client.FailedRequestException: Local message: failed to apply resource at internal/uris: Internal Server Error. Server Message: Server (not a REST instance?) did not respond with an expected REST Error message.
at com.marklogic.client.impl.OkHttpServices.uris(OkHttpServices.java:3030)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3438)
at com.marklogic.client.impl.QueryManagerImpl.uris(QueryManagerImpl.java:169)
Exception in thread "pool-11-thread-3" com.marklogic.client.FailedRequestException: Local message: failed to apply resource at internal/uris: Internal Server Error. Server Message: Server (not a REST instance?) did not respond with an expected REST Error message.
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3373)
at com.marklogic.client.datamovement.impl.QueryBatcherImpl$QueryTask.run(QueryBatcherImpl.java:738)
at com.marklogic.client.impl.OkHttpServices.checkStatus(OkHttpServices.java:4449)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.marklogic.client.impl.OkHttpServices.uris(OkHttpServices.java:3030)
at java.base/java.lang.Thread.run(Unknown Source)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3438)
at com.marklogic.client.impl.QueryManagerImpl.uris(QueryManagerImpl.java:169)
at com.marklogic.client.impl.OkHttpServices.processQuery(OkHttpServices.java:3130)
at com.marklogic.client.impl.OkHttpServices.postResource(OkHttpServices.java:3382)

We would expect:

  • that instead of logging the exception(s), the QueryBatcher calls the registed FailureListeners
  • that the QueryBatcher no longer considers itself to be "running" (since all it's worker threads are now dead)
  • the exception should not be logged when the error is escalated

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions