https://kotlinlang.org logo
Title
t

Tim McCarthy

07/15/2021, 7:36 PM
I'm getting the following socket timeout exception on all HTTPS connections when I run my app from the MacOS app bundle created by
./gradlew createDistributable
, but not when running it by clicking the Run button inside IDEA or from the CLI with
./gradlew run
. What might be different between those environments? (fuel is in the trace for context, but I ran into similar issues with okhttp3)
Caused by: java.net.SocketTimeoutException: Read timed out
	java.base/sun.nio.ch.NioSocketImpl.timedRead(Unknown Source)
	java.base/sun.nio.ch.NioSocketImpl.implRead(Unknown Source)
	java.base/sun.nio.ch.NioSocketImpl.read(Unknown Source)
	java.base/sun.nio.ch.NioSocketImpl$1.read(Unknown Source)
	java.base/java.net.Socket$SocketInputStream.read(Unknown Source)
	java.base/sun.security.ssl.SSLSocketInputRecord.read(Unknown Source)
	java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(Unknown Source)
	java.base/sun.security.ssl.SSLSocketInputRecord.decode(Unknown Source)
	java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
	java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
	java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
	java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
	java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
	java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
	java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
	com.github.kittinunf.fuel.toolbox.HttpClient.sendRequest(HttpClient.kt:145)
	com.github.kittinunf.fuel.toolbox.HttpClient.doRequest(HttpClient.kt:79)
	com.github.kittinunf.fuel.toolbox.HttpClient.executeRequest(HttpClient.kt:37)
m

Michael Paus

07/16/2021, 10:27 AM
Which java modules did you add for building the bundle? In order to make a HTTPS connection you have to explicitly add jdk.crypto.ec . This is necessary because this module is loaded at runtime and cannot be detected by a static analysis at build time.
t

Tim McCarthy

07/16/2021, 6:33 PM
That worked. Thanks Michael! Never would have thought to look at that on my own.
m

Michael Paus

07/16/2021, 7:52 PM
You are welcome. I had to learn it the hard way too 😀
a

alexey.tsvetkov

07/19/2021, 3:32 PM
BTW since the module is relatively small, and similar issues are so common, the module will be included by default in the next build (the one after 0.5.0-build245) https://github.com/JetBrains/compose-jb/commit/b73b09dffc38250107edf753e1f6e1da5ffbed5f
👍 2