Skip to content

timeoutMs attribute on Options annotation on repositories is currently ignored. Possibly others. #1795

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
mikereiche opened this issue Aug 4, 2023 · 1 comment
Assignees

Comments

@mikereiche
Copy link
Collaborator

No description provided.

@mikereiche
Copy link
Collaborator Author

mikereiche commented Aug 4, 2023

When debugging this - keep in mind that timeout is not dumped out by ClassicCoreQueryOpts.convertOptions() https://issues.couchbase.com/browse/JVMCBC-1347. For some reason it is handled outside that :

private QueryRequest queryRequest(String statement,
CoreQueryOptions options,
@nullable CoreQueryContext queryContext,
@nullable NodeIdentifier target) {
notNullOrEmpty(statement, "Statement", () -> new ReducedQueryErrorContext(statement));
notNull(options, "options");

Duration timeout = options.commonOptions().timeout().orElse(core.context().environment().timeoutConfig().queryTimeout());
RetryStrategy retryStrategy = options.commonOptions().retryStrategy().orElse(core.context().environment().retryStrategy());

ObjectNode query = convertOptions(options);
query.put("statement", statement);
query.put("timeout", encodeDurationToMs(timeout));
if (queryContext != null) {
  query.put("query_context", queryContext.format());
}


	userRepository.withOptions(QueryOptions.queryOptions().timeout(Duration.ofMillis(1))).findByFirstname("Dave");

2023-08-04 10:16:27,868 DEBUG core.ReactiveFindByQueryOperationSupport: 184 - findByQuery scope: null collection: null options: com.couchbase.client.java.query.QueryOptions@6c8e5ac4 statement: SELECT t, jsonNode, jsonObject, jsonArray, META(441b92a5-8d44-4fa8-8b8a-17256958386c).cas AS __cas, createdBy, createdDate, lastModifiedBy, lastModifiedDate, META(441b92a5-8d44-4fa8-8b8a-17256958386c).id AS __id, firstname, lastname, subtype FROM 441b92a5-8d44-4fa8-8b8a-17256958386c WHERE t = "abstractuser" AND firstname = $1
2023-08-04 10:16:27,870 DEBUG data.couchbase.core.query.OptionsBuilder: 106 - query options: {"args":["Dave"],"client_context_id":"71b63264-5f93-4f68-a5bc-1bea0a844282","metrics":false,"scan_consistency":"request_plus"}

com.couchbase.client.core.error.UnambiguousTimeoutException: QueryRequest, Reason: TIMEOUT {"cancelled":true,"completed":true,"coreId":"0xa31f522900000002","idempotent":true,"lastDispatchedFrom":"127.0.0.1:64655","lastDispatchedTo":"127.0.0.1:8093","reason":"TIMEOUT","requestId":27,"requestType":"QueryRequest","retried":0,"service":{"operationId":"null","statement":"SELECT t, jsonNode, jsonObject, jsonArray, META(441b92a5-8d44-4fa8-8b8a-17256958386c).cas AS __cas, createdBy, createdDate, lastModifiedBy, lastModifiedDate, META(441b92a5-8d44-4fa8-8b8a-17256958386c).id AS __id, firstname, lastname, subtype FROM 441b92a5-8d44-4fa8-8b8a-17256958386c WHERE t = "abstractuser" AND firstname = $1","type":"query"},"timeoutMs":1,"timings":{"dispatchMicros":4920,"totalDispatchMicros":4920,"totalMicros":12500}}

@mikereiche mikereiche self-assigned this Aug 16, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant