when i use retrofit download file.
11-03 22:52:35.048 18649-18699/better.hello W/System.err: java.io.InterruptedIOException: thread interrupted
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okio.Timeout.throwIfReached(Timeout.java:145)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okio.Okio$2.read(Okio.java:137)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okio.AsyncTimeout$2.read(AsyncTimeout.java:238)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:45)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okhttp3.internal.http.Http1xStream$FixedLengthSource.read(Http1xStream.java:381)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okio.RealBufferedSource.read(RealBufferedSource.java:45)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okio.ForwardingSource.read(ForwardingSource.java:35)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at retrofit2.OkHttpCall$ExceptionCatchingRequestBody$1.read(OkHttpCall.java:279)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at okio.RealBufferedSource$1.read(RealBufferedSource.java:386)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at java.io.InputStream.read(InputStream.java:162)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at better.hello.util.FileUtils.writeFile(FileUtils.java:120)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at better.hello.common.UiHelper$1$1.call(UiHelper.java:29)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at better.hello.common.UiHelper$1$1.call(UiHelper.java:26)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at rx.Observable.unsafeSubscribe(Observable.java:10200)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:248)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at rx.internal.operators.OperatorSubscribeOn$1$1.onNext(OperatorSubscribeOn.java:53)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at retrofit2.adapter.rxjava.OperatorMapResponseToBodyOrError$1.onNext(OperatorMapResponseToBodyOrError.java:41)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at retrofit2.adapter.rxjava.OperatorMapResponseToBodyOrError$1.onNext(OperatorMapResponseToBodyOrError.java:38)
11-03 22:52:35.049 18649-18699/better.hello W/System.err: at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(RxJavaCallAdapterFactory.java:173)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.operators.OperatorSubscribeOn$1$1$1.request(OperatorSubscribeOn.java:80)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.Subscriber.setProducer(Subscriber.java:211)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.operators.OperatorSubscribeOn$1$1.setProducer(OperatorSubscribeOn.java:76)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.Subscriber.setProducer(Subscriber.java:205)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:152)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$CallOnSubscribe.call(RxJavaCallAdapterFactory.java:138)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.Observable.unsafeSubscribe(Observable.java:10200)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:228)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
11-03 22:52:35.050 18649-18699/better.hello W/System.err: at java.lang.Thread.run(Thread.java:818)
there is my snippet:
HttpUtil.downFile(mp4_url).subscribeOn(Schedulers.io()).flatMap(new Func1<ResponseBody, Observable<DownloadInfo>>() {
@Override
public Observable<DownloadInfo> call(final ResponseBody body) {
return Observable.create(new Observable.OnSubscribe<DownloadInfo>() {
@Override
public void call(Subscriber<? super DownloadInfo> subscriber) {
FileUtils.writeFile(subscriber, body, fileName);
}
});
}
}).unsubscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<DownloadInfo>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(DownloadInfo info) {
}
});
public static void writeFile(Subscriber<? super DownloadInfo> subscriber, ResponseBody body, String fileName) {
try {
File file = getFile(fileName);
long readSize = 0, length = body.contentLength();
byte buffer[] = new byte[4096];
FileOutputStream outputStream = new FileOutputStream(file, true);
InputStream ins = body.byteStream();
DownloadInfo info = new DownloadInfo(length);
while (true) {
int read = ins.read(buffer);
if (read <= 0) {
subscriber.onCompleted();
break;
}
outputStream.write(buffer, 0, read);
readSize += read;
info.setReadFileSize(readSize);
info.setProgress(readSize / length);
subscriber.onNext(info);
Utils.d("Better", "下载了==" + readSize + ",total=" + length);
}
if (null != outputStream) {
outputStream.flush();
outputStream.close();
}
if (null != ins) {
ins.close();
}
if (null!=body){
body.close();
}
} catch (Exception e) {
e.printStackTrace();
subscriber.onError(e);
}
}
if i annotate the line: 'subscriber.onNext(info);' in writeFile method,everything will be ok and will download file correctly。
why ?
someone can help me ?
The HTTP client read timeout happened. Create your own OkHttpClient instance, set a larger read timeout, and pas to Retrofit in the Builder's client() method.
i have set one hour.is did not work.
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.connectTimeout(1, TimeUnit.HOURS)
.writeTimeout(1,TimeUnit.HOURS)
.readTimeout(1,TimeUnit.HOURS)
.addInterceptor(mLoggingInterceptor);
That's way too long. The default is 10 seconds, but sometimes a bit larger is needed. A timeout is something that is a good because it indicates a network that acts like it's connected but in actually isn't working. The stacktrace clearly indicates that a timeout is a the problem, so I don't really know what to tell you.
Somewhat related, you should really try to use Okio for writing to a file which will save you a lot of lines of code:
Sink fileSink = Okio.sink(file);
body.source().writeAll(fileSink);
(with proper try/finally/close or try-with-resources, of course)
ok this time i try to use Okio .
Unfortunately the java.io.InterruptedIOException: thread interrupted happend again lastnight.
All I want to do is download file and show progress.
The snippet of okio to write file:
public static void writeFile(Subscriber<? super DownloadInfo> subscriber, ResponseBody body, String fileName) {
try {
File file = getFile(fileName);
BufferedSink sink = Okio.buffer(Okio.sink(file));
Buffer buffer = sink.buffer();
long readSize = 0, length = body.contentLength(), read;
int step = 4069;
BufferedSource source = body.source();
DownloadInfo info = new DownloadInfo(length);
while ((read = source.read(buffer, step)) != -1) {
readSize += read;
info.setReadFileSize(readSize);
Utils.d("Better", "下载了==" + readSize + ",total=" + length);
subscriber.onNext(info);
}
sink.close();
subscriber.onCompleted();
} catch (Exception e) {
e.printStackTrace();
subscriber.onError(e);
}
}
if i do not call subscriber.onNext(info) in the while circle ,everything will be ok ,and the file will be download correctly.So i think the way i write file to disk is right.The place where the error can occur is subscribe.onNext().I just do not known why.
I am facing the same issue while using OkHttp to download around 40 Mb file using background service.
01-04 21:35:42.639 29189-29272/com.download.debug E/DownloadManager$downloa: Firmware downloading exception, deleting file.
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: java.io.InterruptedIOException: thread interrupted
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at okio.Timeout.throwIfReached(Timeout.java:145)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at okio.Okio$1.write(Okio.java:76)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at okio.RealBufferedSink.emit(RealBufferedSink.java:178)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at com.download.restapi.DownloadManager$downloadBinary$1.subscribe(DownloadManager.kt:40)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:40)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSampleTimed.subscribeActual(ObservableSampleTimed.java:46)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFilter.subscribeActual(ObservableFilter.java:30)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableDistinct$DistinctObserver.onNext(ObservableDistinct.java:85)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:146)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFilter$FilterObserver.onNext(ObservableFilter.java:52)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableElementAt$ElementAtObserver.onNext(ObservableElementAt.java:87)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlattenIterable$FlattenIterableObserver.onNext(ObservableFlattenIterable.java:111)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:64)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableToList$ToListObserver.onComplete(ObservableToList.java:100)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:367)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:323)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onComplete(ObservableFlatMap.java:300)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:367)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:323)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onComplete(ObservableFlatMap.java:300)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onComplete(ObservableSubscribeOn.java:68)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onComplete(BodyObservable.java:66)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:47)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:452)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.lang.Thread.run(Thread.java:818)
@JakeWharton @471448446 can you please help to figure out this.
using OKHttp : 3.9.0
That looks like a normal timeout.
On Thu, Jan 4, 2018 at 12:50 PM Bipin Vayalu notifications@github.com
wrote:
I am facing the same issue while using OkHttp to download around 40 Mb
file using background service.01-04 21:35:42.639 29189-29272/com.download.debug E/DownloadManager$downloa: Firmware downloading exception, deleting file.
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: java.io.InterruptedIOException: thread interrupted
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at okio.Timeout.throwIfReached(Timeout.java:145)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at okio.Okio$1.write(Okio.java:76)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at okio.RealBufferedSink.emit(RealBufferedSink.java:178)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at com.download.restapi.DownloadManager$downloadBinary$1.subscribe(DownloadManager.kt:40)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableCreate.subscribeActual(ObservableCreate.java:40)
01-04 21:35:42.642 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSampleTimed.subscribeActual(ObservableSampleTimed.java:46)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFilter.subscribeActual(ObservableFilter.java:30)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:162)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableDistinct$DistinctObserver.onNext(ObservableDistinct.java:85)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:146)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFilter$FilterObserver.onNext(ObservableFilter.java:52)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableElementAt$ElementAtObserver.onNext(ObservableElementAt.java:87)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onNext(ObservableSubscribeOn.java:58)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlattenIterable$FlattenIterableObserver.onNext(ObservableFlattenIterable.java:111)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:64)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableToList$ToListObserver.onComplete(ObservableToList.java:100)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:367)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:323)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onComplete(ObservableFlatMap.java:300)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drainLoop(ObservableFlatMap.java:367)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.drain(ObservableFlatMap.java:323)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onComplete(ObservableFlatMap.java:300)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onComplete(ObservableSubscribeOn.java:68)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at retrofit2.adapter.rxjava2.BodyObservable$BodyObserver.onComplete(BodyObservable.java:66)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:47)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at retrofit2.adapter.rxjava2.BodyObservable.subscribeActual(BodyObservable.java:34)
01-04 21:35:42.643 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Observable.subscribe(Observable.java:10903)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:452)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
01-04 21:35:42.644 29189-29272/com.download.debug E/DownloadManager$downloa: at java.lang.Thread.run(Thread.java:818)@JakeWharton https://github.com/jakewharton @471448446
https://github.com/471448446 can you please help to figure out this.
using OKHttp : 3.9.0—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/square/retrofit/issues/2069#issuecomment-355350932,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEERXGbmWnLin5_P_no9fuBu1XMkPrks5tHQ9ngaJpZM4Kodl6
.
But I am setting up an infinite timeout.
val newClient = OkHttpClient.Builder()
.connectTimeout(0, TimeUnit.HOURS)
.readTimeout(0, TimeUnit.HOURS)
.writeTimeout(0, TimeUnit.HOURS)
.build()
I don't know then. If you're using HTTP/2 maybe the server is causing
enforcement. Bottom line the exception comes from OkHttp. Retrofit is not
involved.
On Thu, Jan 4, 2018 at 12:54 PM Bipin Vayalu notifications@github.com
wrote:
But I am setting up an infinite timeout.
val newClient = OkHttpClient.Builder()
.connectTimeout(0, TimeUnit.HOURS)
.readTimeout(0, TimeUnit.HOURS)
.writeTimeout(0, TimeUnit.HOURS)
.build()—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/square/retrofit/issues/2069#issuecomment-355352052,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEEETiStTTZah1SHSwUVX3SrRpi0CTkks5tHRBogaJpZM4Kodl6
.
I don't believe setting a larger timeout is the best solution.
I'm facing this issue after upgrading RxJava from 2.1.3 to 2.2.1!
RxJava library causes this issue since your code or Retrofit tries to cancel Observable which causes to cancel the worker thread! what is the RxJava library version you are using?