Getting TimeoutException while fetching and inserting into Couch Base Server


I am facing below issue while fetching and inserting the Document into CB server using java sdk. Please find the below exception stack trace,

java.lang.RuntimeException: java.util.concurrent.TimeoutException

This stack trace is for get operation and similar exception I am facing in case of upsert binary document.
Also, while fetching the Document from CB server, the timeout set is 4sec(as well tested with timeout 10 sec). In both cases, I am facing the issue. Currently I am using CB server version : 4.0.0 and CB client library version 2.2.8. Till now the analysis which I have done is given below,

I have debugged the CB client library code and found that its decreasing the countdownlatch using observer-subscriber which is another thread model and calling await() api with given timestamp in parent thread. So, the issue is that observer-subscriber thread is failing to decrease the countdownlatch and timeout period is getting elapsed because of which await() api is returning the false and throwing TimeoutException(). Also, I am performing the fetch operation in for loop (i.e. get() call per iteration). So, for some keys, facing the issue.

Please anyone who resolved the issue? or is there any alternate solution to achieve the same?

Are you calling bucket.async() anywhere in your application, by any chance? If so, can you share that code?

No. I am not calling any such async() API in my code.

Can you reproduce the problem in isolation and capture a detailed SDK log of it?

You’d have to configure logging level to be the most detailed, TRACE in Log4J for instance.

sure simonbasle. I will change the logging level and will provide the detailed SDK logs.

Hi simonbasle,

I have captured the TRACE level logs. Will you please tell me what kind of logs statement u need?

I’ll need the whole log file. You can send it to me directly via private message if you want.

was there maybe an older version of the client that doesn’t have thes TimeoutExceptions? I am also getting those, while I never had any issues with the 1.x java client so I’m contemplating moving back to that one