rxhttp icon indicating copy to clipboard operation
rxhttp copied to clipboard

上传超大文件异常(单个20g文件)

Open wYulin opened this issue 3 years ago • 2 comments

无法上传超大文件

2022-09-10 16:29:27.014 6048-6289/dtdsn.nas I/System.out: [java.net.SocketException: Broken pipe, java.net.SocketException: Broken pipe]
2022-09-10 16:29:27.019 6048-6289/dtdsn.nas W/System.err: java.net.SocketException: Broken pipe
2022-09-10 16:29:27.019 6048-6289/dtdsn.nas W/System.err:     at java.net.SocketOutputStream.socketWrite0(Native Method)
2022-09-10 16:29:27.019 6048-6289/dtdsn.nas W/System.err:     at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:117)
2022-09-10 16:29:27.019 6048-6289/dtdsn.nas W/System.err:     at java.net.SocketOutputStream.write(SocketOutputStream.java:161)
2022-09-10 16:29:27.019 6048-6289/dtdsn.nas W/System.err:     at okio.OutputStreamSink.write(JvmOkio.kt:57)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okio.AsyncTimeout$sink$1.write(AsyncTimeout.kt:99)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.kt:255)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okio.RealBufferedSink.write(RealBufferedSink.kt:146)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http1.Http1ExchangeCodec$KnownLengthSink.write(Http1ExchangeCodec.kt:271)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okio.ForwardingSink.write(ForwardingSink.kt:29)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.connection.Exchange$RequestBodySink.write(Exchange.kt:218)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.kt:255)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okio.RealBufferedSink.writeAll(RealBufferedSink.kt:194)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at rxhttp.wrapper.entity.FileRequestBody.writeTo(FileRequestBody.java:67)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.kt:157)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okhttp3.MultipartBody.writeTo(MultipartBody.kt:93)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:59)
2022-09-10 16:29:27.020 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at rxhttp.wrapper.intercept.LogInterceptor.intercept(LogInterceptor.kt:28)
2022-09-10 16:29:27.021 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
2022-09-10 16:29:27.022 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
2022-09-10 16:29:27.022 6048-6289/dtdsn.nas W/System.err:     at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
2022-09-10 16:29:27.022 6048-6289/dtdsn.nas W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2022-09-10 16:29:27.022 6048-6289/dtdsn.nas W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2022-09-10 16:29:27.022 6048-6289/dtdsn.nas W/System.err:     at java.lang.Thread.run(Thread.java:920)
2022-09-10 16:29:27.022 6048-6289/dtdsn.nas W/System.err: 	Suppressed: java.net.SocketException: Broken pipe
2022-09-10 16:29:27.023 6048-6289/dtdsn.nas W/System.err: 		... 32 more
2022-09-10 16:29:27.023 6048-6289/dtdsn.nas W/System.err: 	Suppressed: java.net.SocketException: Broken pipe
2022-09-10 16:29:27.023 6048-6289/dtdsn.nas W/System.err: 		... 32 more

wYulin avatar Sep 10 '22 08:09 wYulin

android:12 依赖版本:

    def rxhttp_version = '2.9.3'
    implementation 'com.squareup.okhttp3:okhttp:4.10.0'
    implementation "com.github.liujingxing.rxhttp:rxhttp:$rxhttp_version"
    ksp "com.github.liujingxing.rxhttp:rxhttp-compiler:$rxhttp_version"

wYulin avatar Sep 10 '22 08:09 wYulin

贴上代码及rxhttp的请求日志;另外,不管是rxhttp,还是okhttp,对文件上传都没有大小限制,要先确定接口是否支持上传大文件,postman可以先去调通

liujingxing avatar Sep 10 '22 15:09 liujingxing

应该是okhttp的问题,文件过大导致异常了

wYulin avatar Sep 20 '22 13:09 wYulin