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: Task rejected from ScheduledThreadPoolExecutor #694

Closed
dpgmedia-gdebrucker opened this issue Aug 1, 2024 · 1 comment
Assignees
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.

Comments

@dpgmedia-gdebrucker
Copy link

Describe the bug
In Crashlytics we see 109 crashes during the initialisation of Snowplow. The stack trace is always the same, the "pool size" and "completed tasks" vary.

The completed tasks can go up to 23, which I do not understand. Snowplow is one of the very first things we initialise after fetching a remote config at app startup. This initialisation happens through a single instance, so there shouldn't have been any other Snowplow interactions.

Fatal Exception: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@7738e11[Not completed] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@3a2db76[Shutting down, pool size = 5, active threads = 1, queued tasks = 0, completed tasks = 4]
       at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2082)
       at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:842)
       at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:345)
       at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:586)
       at java.util.concurrent.ScheduledThreadPoolExecutor.submit(ScheduledThreadPoolExecutor.java:738)
       at com.snowplowanalytics.core.emitter.Executor.futureCallable(Executor.kt:129)
       at com.snowplowanalytics.core.emitter.storage.SQLiteEventStore.<init>(SQLiteEventStore.kt:71)
       at com.snowplowanalytics.core.emitter.Emitter.getEventStore(Emitter.kt:95)
       at com.snowplowanalytics.core.emitter.Emitter.<init>(Emitter.kt:95)
       at com.snowplowanalytics.core.tracker.ServiceProvider.makeEmitter(ServiceProvider.kt:251)
       at com.snowplowanalytics.core.tracker.ServiceProvider.getOrMakeEmitter(ServiceProvider.kt:185)
       at com.snowplowanalytics.core.tracker.ServiceProvider.makeTracker(ServiceProvider.kt:265)
       at com.snowplowanalytics.core.tracker.ServiceProvider.getOrMakeTracker(ServiceProvider.kt:189)
       at com.snowplowanalytics.core.tracker.ServiceProvider.<init>(ServiceProvider.kt:87)
       at com.snowplowanalytics.snowplow.Snowplow.createTracker(Snowplow.kt:275)
       at <<our-package-name>>.snowplow.SnowplowInitializer.init(SnowplowInitializer.kt:70)
       at <<our-package-name>>.Tracking.<init>(Tracking.kt:51)
       at <<our-package-name>>.Tracking.<init>(Tracking.kt:15)
       at <<our-package-name>>.Tracking.<init>(Tracking.kt:15)
       at <<our-package-name>>.Tracking$Factory.create(Tracking.kt:34)
       at <<our-package-name>>.config.InitConfigHandler$tracking$2.invoke(InitConfigHandler.kt:78)
       at <<our-package-name>>.config.InitConfigHandler$tracking$2.invoke(InitConfigHandler.kt:77)
       at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
       at <<our-package-name>>.config.InitConfigHandler.getTracking$tracking_release(InitConfigHandler.kt:77)
       at <<our-package-name>>.config.InitConfigHandler$1$callback$1$1.invokeSuspend(InitConfigHandler.kt:100)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.CoroutineContextKt.withContinuationContext(CoroutineContext.kt:104)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:86)
       at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
       at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)

To Reproduce
We are not able to reproduce this, this is happening rarely in our production environment.

Expected behavior
If the Snowplow is unable create to initialise is should retry or fail gracefully. Not crash the app.

Screenshots
Screenshot 2024-08-01 at 10 23 07

Device informatoin (please complete the following information):
68% Samsung

  • 6% Galaxy A52s 5G
  • 6% Galaxy A52
  • 5% Galaxy S20 FE 5G
  • 51% Other (34)
    7% Oneplus
    6% TCT Mobile Limited (Alcatel)
    5% Xiaomi
    14% Other (6)
@dpgmedia-gdebrucker dpgmedia-gdebrucker added the type:defect Bugs or weaknesses. The issue has to contain steps to reproduce. label Aug 1, 2024
@matus-tomlein
Copy link
Contributor

Thank you for reporting this @dpgmedia-gdebrucker! We will investigate how to handle the error gracefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:defect Bugs or weaknesses. The issue has to contain steps to reproduce.
Projects
None yet
Development

No branches or pull requests

2 participants