Okhttp: Fatal Exception: java.util.concurrent.RejectedExecutionException

Created on 23 Jun 2017  路  3Comments  路  Source: square/okhttp

I am using okhttp 3.8.0 and getting a lot crashes in crashlytics with this stacktrace

Fatal Exception: java.util.concurrent.RejectedExecutionException: Task d.bh@33f4a51 rejected from java.util.concurrent.ThreadPoolExecutor@63d82b6[Shutting down, pool size = 5, active threads = 5, queued tasks = 0, completed tasks = 22]
       at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2049)
       at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:814)
       at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1360)
       at okhttp3.Dispatcher.promoteCalls(Dispatcher.java:164)
       at okhttp3.Dispatcher.finished(Dispatcher.java:200)
       at okhttp3.Dispatcher.finished(Dispatcher.java:187)
       at okhttp3.RealCall$AsyncCall.execute(RealCall.java:151)
       at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run(Thread.java:762)

What colud be the reason of this ?

enhancement

Most helpful comment

Maybe we should handle this error and call Callback.onFailure() with a cancelation? That would be pretty reasonable.

All 3 comments

You called shutdown on the dispatcher鈥檚 ExecutorService while it still had calls outstanding.

Maybe we should handle this error and call Callback.onFailure() with a cancelation? That would be pretty reasonable.

Was this page helpful?
0 / 5 - 0 ratings