Skip to content

IllegalStateException when decompressing large chunked content #1971

Open
@Jeetah

Description

When Logbook tries to log chunked gzipped content it leads to the exception below.

Description

Does not happen if removing GzipInterceptor - but of course then the compressed content is logged.

Expected Behavior

Chunked content should be logged up to given max-body-length.

Actual Behavior

`java.lang.IllegalStateException: closed

at okio.RealBufferedSource.request(RealBufferedSource.kt:206)
at okio.RealBufferedSource.require(RealBufferedSource.kt:202)
at okio.GzipSource.consumeHeader(GzipSource.kt:104)
at okio.GzipSource.read(GzipSource.kt:62)
at okio.Buffer.writeAll(Buffer.kt:1303)
at okio.RealBufferedSource.readByteArray(RealBufferedSource.kt:239)
at okhttp3.ResponseBody.bytes(ResponseBody.kt:124)
at org.zalando.logbook.okhttp.RemoteResponse$Offering.buffer(RemoteResponse.java:85)
at org.zalando.fauxpas.ThrowingFunction.apply(ThrowingFunction.java:19)
at java.base/java.util.concurrent.atomic.AtomicReference.updateAndGet(AtomicReference.java:210)
at org.zalando.logbook.okhttp.RemoteResponse.buffer(RemoteResponse.java:192)
at org.zalando.logbook.okhttp.RemoteResponse.toResponse(RemoteResponse.java:183)
at org.zalando.logbook.okhttp.LogbookInterceptor.intercept(LogbookInterceptor.java:32)
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.execute(RealCall.kt:154)
at feign.okhttp.OkHttpClient.execute(OkHttpClient.java:176)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:100)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:70)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:99)`

Steps to Reproduce

Us OkHttpClient 3 with both recommended interceptors:
.addNetworkInterceptor(LogbookInterceptor(logbook)) .addNetworkInterceptor(GzipInterceptor())

Context

Cannot process chunked large content when logging is active.

Your Environment

  • Version used: logbook-okhttp 3.9.0

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions