marklogic / marklogic/java-client-api
Non-Retryable requests when transactions are being used?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 61
- Forks
- 74
- Avg merge
- 2d 53m
- Merged PRs (30d)
- 8
Description
We run our integration tests in gitlab in a dockerized environment, and since we started to use MarkLogic server transactions more we noticed our tests behaving increasingly flaky. We suspect the dockerized environment to induce some connection and availability issues. Here is a stacktrace of one of the issues:
com.marklogic.client.FailedRetryException: Service unavailable and maximum retry period elapsed: 0 seconds after 0 retries
at com.marklogic.client.impl.OkHttpServices.sendRequestWithRetry(OkHttpServices.java:576)
at com.marklogic.client.impl.OkHttpServices.headImplExec(OkHttpServices.java:1054)
at com.marklogic.client.impl.OkHttpServices.headImpl(OkHttpServices.java:1016)
at com.marklogic.client.impl.OkHttpServices.head(OkHttpServices.java:972)
at com.marklogic.client.impl.DocumentManagerImpl.exists(DocumentManagerImpl.java:145)
The code leading into this trace is supposed to check, whether a document exists and looks like this:
final DocumentDescriptor documentDescriptor = manager.exists(docUri.toString(), transaction);
The transaction is non-null in the above statement. And as it turns out the OkHttpServices in line 1054:
return sendRequestWithRetry(requestBldr, (transaction == null), doHeadFunction, null);
renders a request using a transaction being "not retryable".
In a distributed system communication errors can happen, regardless of whether a transaction is being used or not. There should be a destinction being made depending on the type of error, whether it makes sense to repeat a request. The existence of a transaction should not make a difference here.
(We are currently using the marklogic-java-client in version 8.0.0 and the Markogic Server in 11.3.1)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with OkHttpServices.sendRequestWithRetry and its callers, especially headImplExec and DocumentManagerImpl.exists, using the stack trace and the transaction argument as the entry points. Review existing retry behavior and tests for transient service failures. Done means the retry decision distinguishes communication errors from transaction handling and covers the transactional exists request with regression tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100