Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please set default socket timeout for ApacheHttpClient #586

Closed
leozilla opened this issue Nov 5, 2018 · 7 comments
Closed

Please set default socket timeout for ApacheHttpClient #586

leozilla opened this issue Nov 5, 2018 · 7 comments
Assignees

Comments

@leozilla
Copy link

leozilla commented Nov 5, 2018

Looking into ApacheHttpClient only the following timeout options are set:

clientBuilder.setDefaultRequestConfig(configBuilder.build());

This has as a consequence that HTTPS requests can hang forever during the HTTPS handshake!
The stack trace can be seen in this ticket and I had the same problem today which I could easily reproduce with our auth service which does not finish the HTTPS handshake for whatever reason.

To fix this, just set a default socket config and specify the SoTimeout

// getSocketTimeout does not exist yet and should be added    
this.clientBuilder.setDefaultSocketConfig(SocketConfig.custom().setSoTimeout(config.getSocketTimeout()).build()); 
@leozilla
Copy link
Author

leozilla commented Nov 5, 2018

Btw: I would like to provide a PR but mvn clean install does not work for me without fixing a ton of errors. I have to say this is really annoying and prevents from contributing to this otherwise very fine project.

@ptrthomas
Copy link
Member

@leozilla sorry to hear that. perhaps you can start with contributing solutions to the "ton of errors" you are seeing

@leozilla
Copy link
Author

leozilla commented Nov 7, 2018

@ptrthomas does mvn clean install work for you? if yes, what java version, what maven version and what OS are you using?

@ptrthomas
Copy link
Member

ptrthomas commented Nov 7, 2018

@leozilla yes

$ mvn --version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T13:28:13+05:30)
Maven home: /Users/somebody/dev/apache-maven
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"

@jlee70
Copy link

jlee70 commented Nov 7, 2018

latest builds fine for me too.
$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
Maven home: /usr/local/apache-maven/apache-maven-3.3.9
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /Users/somebody/.sdkman/candidates/java/8u121/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"

@ptrthomas
Copy link
Member

nevermind, just attempted fix

@ptrthomas ptrthomas added this to the 0.9.0 milestone Nov 30, 2018
@ptrthomas
Copy link
Member

0.9.0 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants