When using Jersey client in a Spring Boot context the connection timeout is the double of what is defined when posting an entity. In short:
client.property(ClientProperties.CONNECT_TIMEOUT, 2000);
invocationBuilder.post(null); // correct connection timeout of 2 sec
invocationBuilder.post(Entity.json(request)); // double connection timeout 4 sec
The problem started with Jersey version 2.31. This project demonstrates the issue with a minimal example: https://github.com/oleborup/jersey-client-connection-timeout
I have not been able to reproduce this in a non Spring Boot context only relying on Jersey dependencies, therefore trying to post here.
Spring Boot version: 2.5.0 Java version: OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
Comment From: snicoll
Thanks for the sample.
I have not been able to reproduce this in a non Spring Boot context only relying on Jersey dependencies.
Can you share the sample where TimeoutTests
passes without Spring Boot? Looking at the code, I don't see how spring boot is involved and we haven't been changing anything recently in that area.
Comment From: oleborup
Can see my Jersey only test was on an older version 🙄 Same problem now. Sorry for disturbing. Any idea where to report this?
Comment From: scottfrederick
The Jersey issue tracker is here: https://github.com/eclipse-ee4j/jersey/issues.
It looks like this problem has already been reported there: https://github.com/eclipse-ee4j/jersey/issues/4742.