Andrea Cosentino created CAMEL-25170:
----------------------------------------

             Summary: camel-couchbase: connectTimeout is silently ignored 
unless queryTimeout is also changed
                 Key: CAMEL-25170
                 URL: https://issues.apache.org/jira/browse/CAMEL-25170
             Project: Camel
          Issue Type: Bug
          Components: camel-couchbase
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino


Setting {{?connectTimeout=...}} on a couchbase endpoint has no effect unless 
{{queryTimeout}} is *also* set to something other than its default. The option 
is documented, has a default of 30000, and is silently inert on its own.

h2. The code

{{CouchbaseEndpoint.createClusterEnvironment()}}:

{code:java}
if (queryTimeout != DEFAULT_QUERY_TIMEOUT) {
    cfb.timeoutConfig()
            .connectTimeout(Duration.ofMillis(connectTimeout))
            .queryTimeout(Duration.ofMillis(queryTimeout));
}
{code}

The guard tests {{queryTimeout}}; the body configures both timeouts. So 
{{connectTimeout}} is only ever applied as a side effect of changing an 
unrelated option.

h2. Observed

Building the environment straight from the endpoint and reading the timeout 
back:

* {{connectTimeout=1234}} alone -> {{env.timeoutConfig().connectTimeout()}} is 
*PT10S*
* {{connectTimeout=1234}} plus {{queryTimeout=9999}} -> *PT1.234S*

There is a second consequence worth spelling out: because the block never runs 
in a default configuration, the component's own documented default of 30000 ms 
is never applied either. What users actually get is the SDK's own default of 10 
s. The catalog says one thing and the runtime does another.

h2. How it got here

The guard arrived with the 3.0.5 SDK upgrade (commit {{025549c010e4}}, 
2020-06-26), where the body set *only* {{queryTimeout}} - guard and body 
matched, and it was correct:

{code:java}
if (queryTimeout != DEFAULT_QUERY_TIMEOUT) {
    cfb.timeoutConfig().queryTimeout(Duration.ofMillis(queryTimeout));
}
{code}

{{.connectTimeout(...)}} was then added *inside* that existing guard by 
CAMEL-15792 (commit {{e4c4d0e101f9}}, 2020-11-16) without widening the 
condition. A second option was folded into a guard written for the first.

h2. Proposed fix

Apply each timeout under its own condition, so that setting either option alone 
works and both documented defaults hold.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to