Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RejectedExecutionException on an internal task scheduling #256

Open
robUx4 opened this issue Oct 6, 2014 · 1 comment · May be fixed by #257
Open

RejectedExecutionException on an internal task scheduling #256

robUx4 opened this issue Oct 6, 2014 · 1 comment · May be fixed by #257

Comments

@robUx4
Copy link
Contributor

robUx4 commented Oct 6, 2014

I get this error on 4.4.4 devices (non rooted). This is happening early in the lifetime of the process, within the first second the app is launched.

I noticed synchronousWorkers is not final, but I don't think it will make much of a difference.

java.util.concurrent.RejectedExecutionException: Task com.koushikdutta.async.AsyncServer$1@6531fc10 rejected from java.util.concurrent.ThreadPoolExecutor@650341c0[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
       at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011)
       at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793)
       at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
       at com.koushikdutta.async.AsyncServer.wakeup(SourceFile:126)
       at com.koushikdutta.async.AsyncServer.postDelayed(SourceFile:160)
       at com.koushikdutta.async.AsyncServer.post(SourceFile:167)
       at com.koushikdutta.async.http.AsyncHttpClient.execute(SourceFile:185)
       at com.koushikdutta.async.http.AsyncHttpClient.execute(SourceFile:124)
       at com.koushikdutta.ion.loader.HttpLoader.load(SourceFile:24)
       at com.koushikdutta.ion.IonRequestBuilder.loadRequest(SourceFile:376)
       at com.koushikdutta.ion.IonRequestBuilder.invokeLoadRequest(SourceFile:370)
       at com.koushikdutta.ion.IonRequestBuilder$4.run(SourceFile:360)
       at com.koushikdutta.async.AsyncServer$RunnableWrapper.run(SourceFile:53)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:136)
       at android.app.ActivityThread.main(ActivityThread.java:5001)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
@robUx4
Copy link
Contributor Author

robUx4 commented Oct 6, 2014

Looking at the ThreadPoolExecutor code it seems the "Terminated" string indicates the executor is dead. There is no call to shutdown() in your code, so the other option could be that the executor finalize() has been called (thus shutdown() being called). Maybe due to a premature death or the app being killed soon after a background startup in the background.

I think before calling execute() you should check the isShutdown() state of the executor. Silently doing nothing if they're dead.

robUx4 added a commit to robUx4/AndroidAsync that referenced this issue Oct 6, 2014
@robUx4 robUx4 linked a pull request Oct 6, 2014 that will close this issue
robUx4 added a commit to robUx4/AndroidAsync that referenced this issue Oct 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant