Closed shafayatb closed 6 years ago
Provide the full stacktrace.
Here is the stack trace,
01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: javax.net.ssl.SSLHandshakeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid input to toASCII: v115_2.korbytstaging.com 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@11951470:21) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:281) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:251) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:151) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 01-05 15:47:13.391 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 01-05 15:47:13.392 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at java.lang.Thread.run(Thread.java:761) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: Caused by: java.security.cert.CertificateException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid input to toASCII: v115_2.korbytstaging.com 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms@11951470:8) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.SslWrapper.doHandshake(:com.google.android.gms@11951470:2) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@11951470:19) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: ... 23 more 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid input to toASCII: v115_2.korbytstaging.com 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.Platform.checkTrusted(:com.google.android.gms@11951470:7) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.Platform.checkServerTrusted(:com.google.android.gms@11951470:1) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms@11951470:5) 01-05 15:47:13.393 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: ... 26 more 01-05 15:47:13.400 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: Caused by: java.lang.IllegalArgumentException: Invalid input to toASCII: v115_2.korbytstaging.com 01-05 15:47:13.400 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at java.net.IDN.toASCII(IDN.java:112) 01-05 15:47:13.400 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at javax.net.ssl.SNIHostName.
(SNIHostName.java:99) 01-05 15:47:13.400 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.Platform.setParametersSniHostname(:com.google.android.gms@11951470:2) 01-05 15:47:13.400 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.Platform.getSSLParameters(:com.google.android.gms@11951470:2) 01-05 15:47:13.400 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.getSSLParameters(:com.google.android.gms@11951470) 01-05 15:47:13.401 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:302) 01-05 15:47:13.401 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94) 01-05 15:47:13.401 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88) 01-05 15:47:13.401 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at java.lang.reflect.Method.invoke(Native Method) 01-05 15:47:13.401 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at com.google.android.gms.org.conscrypt.Platform.checkTrusted(:com.google.android.gms@11951470:2) 01-05 15:47:13.401 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: ... 28 more 01-05 15:47:13.407 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: Caused by: The input does not conform to the STD 3 ASCII rules. line: 0. preContext: . postContext: 5_2 01-05 15:47:13.407 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at android.icu.impl.IDNA2003.convertToASCII(IDNA2003.java:214) 01-05 15:47:13.407 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at android.icu.impl.IDNA2003.convertIDNToASCII(IDNA2003.java:275) 01-05 15:47:13.407 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at android.icu.text.IDNA.convertIDNToASCII(IDNA.java:652) 01-05 15:47:13.407 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: at java.net.IDN.toASCII(IDN.java:110) 01-05 15:47:13.407 5098-5098/com.rmgnetworks.korbyt.go.debug W/System.err: ... 37 more
This is either an OkHttp bug, Conscrypt bug, or working as intended (in the sense that Retrofit has no control over it).
@swankjesse is this supposed to be normalized at OkHttp's layer first?
Can ya get the full stack trace? ... 37 more
at the bottom might be where OkHttp is calling into whatever fails this way.
Hostnames shouldn't have underscores in ’em. Even if OkHttp tries to make it work, our underlying TLS infrastructure might not cooperate. That's likely the cause here. But the full stack trace can confirm that.
@swankjesse Here the all of the stacktrace,
java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid input to toASCII: v115_2.korbytstaging.com at com.google.android.gms.org.conscrypt.Platform.checkTrusted(:com.google.android.gms@11743470:7) at com.google.android.gms.org.conscrypt.Platform.checkServerTrusted(:com.google.android.gms@11743470:1) at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms@11743470:5) at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) at com.google.android.gms.org.conscrypt.SslWrapper.doHandshake(:com.google.android.gms@11743470:2) at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@11743470:19) at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:281) at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:251) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:151) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) Caused by: java.lang.IllegalArgumentException: Invalid input to toASCII: v115_2.korbytstaging.com at java.net.IDN.toASCII(IDN.java:112) at javax.net.ssl.SNIHostName.
(SNIHostName.java:99) at com.google.android.gms.org.conscrypt.Platform.setParametersSniHostname(:com.google.android.gms@11743470:2) at com.google.android.gms.org.conscrypt.Platform.getSSLParameters(:com.google.android.gms@11743470:2) at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.getSSLParameters(Unknown Source:6) at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:335) at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94) at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88) at java.lang.reflect.Method.invoke(Native Method) at com.google.android.gms.org.conscrypt.Platform.checkTrusted(:com.google.android.gms@11743470:2) at com.google.android.gms.org.conscrypt.Platform.checkServerTrusted(:com.google.android.gms@11743470:1) at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms@11743470:5) at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) at com.google.android.gms.org.conscrypt.SslWrapper.doHandshake(:com.google.android.gms@11743470:2) at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@11743470:19) at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:281) at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:251) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:151) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) Caused by: The input does not conform to the STD 3 ASCII rules. line: 0. preContext: . postContext: 5_2
at android.icu.impl.IDNA2003.convertToASCII(IDNA2003.java:216)
at android.icu.impl.IDNA2003.convertIDNToASCII(IDNA2003.java:277)
at android.icu.text.IDNA.convertIDNToASCII(IDNA.java:654)
at java.net.IDN.toASCII(IDN.java:110)
at javax.net.ssl.SNIHostName.<init>(SNIHostName.java:99)
at com.google.android.gms.org.conscrypt.Platform.setParametersSniHostname(:com.google.android.gms@11743470:2)
at com.google.android.gms.org.conscrypt.Platform.getSSLParameters(:com.google.android.gms@11743470:2)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.getSSLParameters(Unknown Source:6)
at com.android.org.conscrypt.TrustManagerImpl.getTrustedChainForServer(TrustManagerImpl.java:335)
at android.security.net.config.NetworkSecurityTrustManager.checkServerTrusted(NetworkSecurityTrustManager.java:94)
at android.security.net.config.RootTrustManager.checkServerTrusted(RootTrustManager.java:88)
at java.lang.reflect.Method.invoke(Native Method)
at com.google.android.gms.org.conscrypt.Platform.checkTrusted(:com.google.android.gms@11743470:2)
at com.google.android.gms.org.conscrypt.Platform.checkServerTrusted(:com.google.android.gms@11743470:1)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms@11743470:5)
at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.google.android.gms.org.conscrypt.SslWrapper.doHandshake(:com.google.android.gms@11743470:2)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@11743470:19)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:281)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:251)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:151)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:192)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:121)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:100)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
@JakeWharton @swankjesse I think this is an android 7.0+ issue. I have tried to get a response from the same url by using httpurlconnection and I am getting the same error.
Damn, explaining this to my CTO will be a hassle. :(
Consider asking the team that owns the server not to use underscores in host names?
@swankjesse Yeah I brought up the issue and they said they will put a check when any invalid characters is set in the host name.
I am going to close this issue as this is a android issue/feature rather than retrofit issue.
Thanks for the help guys.
here I solved the problem somehow: https://stackoverflow.com/a/59736352/12283105
Hi,
I am having an issue with urls having underscores. I get the following error when i tried a post request for the url " v115_2.korbytstaging.com",
"java.lang.RuntimeException: java.lang.IllegalArgumentException: Invalid input to toASCII: v115_2.korbytstaging.com"
These urls are coming dynamically from the server so I cannot remove the underscores even if I want to.
This is only happening on android 7.0 and up. I have tested this on android 5.1.1 and 6.0 and the url seems to be working.
If there is a fix around this issue it would be really helpful.