-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
As reported in rburgst/okhttp-digest#33 , we encountered an issue when we ran with OkHttp in our stress tests. I see most tests fail with error messages like:
WARNING: previous digest authentication with same nonce failed, returning null
com.marklogic.client.FailedRequestException: Local message: write failed: Unauthorized. Server Message: Unauthorized
at com.marklogic.client.impl.OkHttpServices.putPostDocumentImpl(OkHttpServices.java:1466)
at com.marklogic.client.impl.OkHttpServices.putDocument(OkHttpServices.java:1117)
at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:836)
at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:708)
at com.marklogic.client.impl.DocumentManagerImpl.write(DocumentManagerImpl.java:652)
at test.stress.JavaAPISession.putDocument(JavaAPISession.java:220)
at test.stress.RestQueryTester.runTest(RestQueryTester.java:133)
at test.stress.StressTest.run(StressTest.java:378)
This should definitely not be happening, because the user is authorized and most requests succeed. To have some intermittent failures with the error "FailedRequestException ... Unauthorized" means the same user/password combo is failing intermittently. As reported in the issue linked above, I believe this is because the tests are running multi-threaded, and DigestAuthenticator isn't designed for that. We must either get a fix from the developer or fix this ourselves as most of our clients deploy our API in a multi-threaded environment.