Skip to content

apns-http2: v2.0.0 is not pulling in the version of okHttp specified in pom.xml #93

@alenkalac

Description

@alenkalac

HI - Im seeing issues with apns-http2 within the component im working on -
due to security issues we are to upgrade our okHttp to 4.9.2 - checking pom.xml of this project i can see its pulling in

<okhttp.version>4.8.1</okhttp.version>

exploring my dep tree - i see clevertap is bringing in OkHttp3 instead of OkHttp4

due to common-codecs library by the looks of things, it's getting downgraded back to 3.14.9

+--- com.clevertap.apns:apns-http2:2.0.0
|    +--- com.fasterxml.jackson.core:jackson-core:2.7.0 -> 2.11.3
|    +--- com.fasterxml.jackson.core:jackson-databind:2.1.4 -> 2.11.3 (*)
|    +--- commons-codec:commons-codec:1.11 -> 1.15
|    \--- com.squareup.okhttp3:okhttp:4.8.1 -> 3.14.9
|         \--- com.squareup.okio:okio:1.17.2

Enforcing okHttp4 results in connection errors to apns and seems that there might be issues with http2 client where it gets downgraded to http1 for some reason - this however is not the case with OkHttp3 and works as expected.

This is what i'm seeing with okHttp4

[http-nio-8093-exec-8] INFO com.app.notifier.server.controller.NotificationController - Received notification delivery request for userId: d92938d187e443d7bb1ed236c471d340
[OkHttp https://localhost:8000/...] ERROR com.app.notifier.driver.apns.ApnsPushGatewayClient - An unexpected exception occurred while sending notification to APNS.
java.io.IOException: unexpected end of stream on https://localhost:8000/...
	at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:202)
	at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.EOFException: \n not found: limit=89 content=00000c0400000000000003000005dc00060000200000003b0700000000007fff…
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:332)
	at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
	at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
	... 16 more
Exception in thread "OkHttp Dispatcher" java.lang.IllegalStateException: An unexpected exception occurred while sending notification to APNS.
	at com.app.notifier.driver.apns.ApnsPushGatewayClient.logErrorAndThrowException(ApnsPushGatewayClient.java:341)
	at com.app.notifier.driver.apns.ApnsPushGatewayClient.logAndThrowUnexpectedException(ApnsPushGatewayClient.java:287)
	at com.app.notifier.driver.apns.ApnsPushGatewayClient.handleResponse(ApnsPushGatewayClient.java:223)
	at com.app.notifier.driver.apns.ApnsPushGatewayClient.access$100(ApnsPushGatewayClient.java:33)
	at com.app.notifier.driver.apns.ApnsPushGatewayClient$1.onFailure(ApnsPushGatewayClient.java:69)
	at com.clevertap.apns.clients.AsyncOkHttpApnsClient$1.onFailure(AsyncOkHttpApnsClient.java:118)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:525)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: unexpected end of stream on https://localhost:8000/...
	at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:202)
	at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
	... 3 more
Caused by: java.io.EOFException: \n not found: limit=89 content=00000c0400000000000003000005dc00060000200000003b0700000000007fff…
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:332)
	at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
	at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
	... 16 more

JDK Version: 1.8.0_292

Any help with this would be greatly appreciated -
Kind regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions