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

java.util.concurrent.RejectedExecutionException #113

Closed
ripplearc opened this issue Mar 16, 2016 · 4 comments
Closed

java.util.concurrent.RejectedExecutionException #113

ripplearc opened this issue Mar 16, 2016 · 4 comments
Labels
bug Something isn't working

Comments

@ripplearc
Copy link

To whom it may concern,

I use the SDK version 2.2.13

After a long period of non-stop running (more than 48 hrs and the S3TransferUtility uploads 1 photo per minute on average), the exception came out of nowhere. Apparently I failed to catch this exception which caused the crash of the app (this following exception was shown by setting DefaultUncaughtExceptionHandler )

What is this exception? How to fix it? Or at least where to catch this exception so that the app would not crash?

Thank you!

java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@3a5f74be rejected from java.util.concurrent.ThreadPoolExecutor@392ac91f[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 106] 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 java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:103) at com.amazonaws.mobileconnectors.s3.transferutility.TransferThreadPool.submitTask(TransferThreadPool.java:46) at com.amazonaws.mobileconnectors.s3.transferutility.TransferRecord.start(TransferRecord.java:160) at com.amazonaws.mobileconnectors.s3.transferutility.TransferService.execCommand(TransferService.java:284) at com.amazonaws.mobileconnectors.s3.transferutility.TransferService$UpdateHandler.handleMessage(TransferService.java:220) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:155) at android.os.HandlerThread.run(HandlerThread.java:61)

@fosterzhang fosterzhang added the bug Something isn't working label Mar 16, 2016
@fosterzhang
Copy link
Contributor

RejectedExecutionException can happen when a new task is added to ThreadPoolExecutor on one of these scenarios:

  • ThreadPoolExecutor is shutting down.
  • ThreadPoolExecutor is full and can't handle more tasks.

The stack trace says ThreadPoolExecutor is shutting down, so it's the first case. This is a rare race condition when a transfer is initiated while TransferService stops itself and terminates ThreadPoolExecutor after being idle for a minute. I label this as bug and will fix it ASAP.

Thanks for torturing the SDK :). Any other findings?

@ripplearc
Copy link
Author

Thank you! Not for the moment but I will keep giving the SDK some hard time :-)

@fosterzhang
Copy link
Contributor

This is fixed in v2.2.14. Check it out http://aws.amazon.com/releasenotes/1790148718365679.

@ripplearc
Copy link
Author

Thank you so much! Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants