Android - Tried to schedule job for non-existent component

See original GitHub issue

Your Environment

  • Plugin version: 4.1.0 (changelogs for 4.1.0 are missing btw)
  • Platform: Android
  • OS version: Android 12
  • Device manufacturer / model: Samsung (SM-G991U)
  • React Native version (react-native -v): 0.67.4
  • Plugin config
await BackgroundFetch.configure(
        {
          minimumFetchInterval: 60 * 3, // <-- minutes (15 is minimum allowed)
          stopOnTerminate: false, // <-- Android-only,
          startOnBoot: true, // <-- Android-only
          enableHeadless: true,
        },
        async (taskId) => {
          try {
            await someAsyncCode();
          } catch (err) {
            console.error('Error in backgroundFetch (app)', err.message || err);
          }

          // Must be called so app is not killed/blamed
          BackgroundFetch.finish(taskId);
        },
        async (taskId) => {
          // task-timeout callback.
          // This task has exceeded its allowed running-time.
          // You must stop what you're doing immediately finish(taskId)
          BackgroundFetch.finish(taskId);
        },
      );

Expected Behavior

No crash

Actual Behavior

Random crash from crash analytics, this is not something I can reproduce.

Steps to Reproduce

Can’t really reproduce this. However, looking at the logs, looks like the app crashed right on startup, on the configure call.

Screen Shot 2022-05-02 at 19 47 12

Context

Basic usage.

Debug logs

java.lang.IllegalArgumentException: Tried to schedule job for non-existent component: ComponentInfo{com.zinspector3/com.transistorsoft.tsbackgroundfetch.FetchJobService}
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2441)
        at android.os.Parcel.createException(Parcel.java:2421)
        at android.os.Parcel.readException(Parcel.java:2404)
        at android.os.Parcel.readException(Parcel.java:2346)
        at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:312)
        at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:47)
        at com.transistorsoft.tsbackgroundfetch.BGTask.schedule(BGTask.java:158)
        at com.transistorsoft.tsbackgroundfetch.BackgroundFetch.registerTask(BackgroundFetch.java:248)
        at com.transistorsoft.tsbackgroundfetch.BackgroundFetch.start(BackgroundFetch.java:136)
        at com.transistorsoft.tsbackgroundfetch.BackgroundFetch.configure(BackgroundFetch.java:100)
        at com.transistorsoft.rnbackgroundfetch.RNBackgroundFetchModule.configure(RNBackgroundFetchModule.java:51)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
        at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java:-2)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:920)

Caused by: android.os.RemoteException: Remote stack trace:
	at com.android.server.job.JobSchedulerService$JobSchedulerStub.enforceValidJobRequest(JobSchedulerService.java:2705)
	at com.android.server.job.JobSchedulerService$JobSchedulerStub.schedule(JobSchedulerService.java:2758)
	at android.app.job.IJobScheduler$Stub.onTransact(IJobScheduler.java:155)
	at android.os.Binder.execTransactInternal(Binder.java:1215)
	at android.os.Binder.execTransact(Binder.java:1179)

        at unknown method(unknown file)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mikehardycommented, May 3, 2022

Hey @cristianoccazinsp - thanks for all your help on netinfo, despite the callback issues there being really frustrating! I sometimes help triage here and I thought this was interesting - it appears to be still in the configure part, but it’s already moved in to the opaque multi-platform (flutter, cordova, react-native etc) AAR code before it has a problem:

https://github.com/transistorsoft/react-native-background-fetch/blob/d0827aa50ef117f7d9a76ae5046af56cdb367592/android/src/main/java/com/transistorsoft/rnbackgroundfetch/RNBackgroundFetchModule.java#L51

So I’m not sure what it can be, but I can at least say to @christocracy that if they want a good collaborator with regards to determining a root cause and testing fixes @cristianoccazinsp is more than capable

Cheers

0reactions
stale[bot]commented, Sep 21, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a “discussion” and I will leave this open.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No such service ComponentInfo Android JobScheduler
Use new ComponentName(Context pkg, String cls) JobScheduler mJobScheduler = (JobScheduler) context.getSystemService(Context.
Read more >
JobSchedulerService.java - Android Code Search
Implements logic for scheduling, and rescheduling jobs. The JobSchedulerService knows nothing. * about constraints, or the state of active jobs.
Read more >
Chapter 6: Attendance & Work Schedules - Swarthmore College
Work hours and schedules vary throughout the College, depending upon the services provided by each area. As part of your orientation, you and...
Read more >
Ordered in October. No Phone - Customer Service: Nonexistent?
However, I have tried so hard to rectify the situation, but cannot reach someone able to help me. I contacted USPS and tried...
Read more >
Best practices for Cloud Firestore - Firebase
Ideally, your application should set up all the required snapshot ... over a lot of deleted data is one that tries to find...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found