-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Android HeadlessJS Crash - Tried to finish non-existent task with id #33883
Comments
Having the same issue |
Having the same issue and I'm unable to reproduce the issue |
Yap same issue continues on 0.69.5. @kelset @cortinico any help please? |
|
That's the issue, I cannot reproduce it in any ways and I have a Samsung with Android 12. Never saw the crash happening but I have some users complaining about it. |
I am having this same as well. Mostly on android Samsung and android 12. Not sure how to reproduce this issue. |
We can't really help further without a reproducer |
Did you guys figure out any fix for this? It seems that this particular code is written here in react native repo, https://github.com/facebook/react-native/blob/main/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java#L174 |
Nope, and yes it looks like that particular code is the responsible, maybe don't throw exception if doesn't find the task to finish? |
Yeah as long as the app does not crash :( |
Did any one got the fix for this crash? |
Nope happening still 😅 |
I am having the same issue |
Still having same issue |
Did anyone got solution for this issue? |
@Saad-Bashar What did you comment on in HeadlessContext class? Can you please help |
@pedrolopes10 Did you find any solutions? |
El sáb, 10 jun 2023 5:28, malikzype ***@***.***> escribió:
… @pedrolopes10 <https://github.com/pedrolopes10> Did you find any
solutions?
—
Reply to this email directly, view it on GitHub
<#33883 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A6XCIFDOYFMHEQZCV2XCUCLXKPZYJANCNFSM5WQGIW2A>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Nope, still happening here |
any update here? |
Yes, even we are facing this issue. |
facing this issue +1 |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Facing this issue |
Summary: Sometimes a headless task tries to finish, but it doesn’t exist, which causes an exception. No one knows how to reliably reproduce it, as it could be a race condition. However, if you attempt to remove a task that has already been removed, it shouldn’t cause an issue since you're trying to remove something that’s already gone (which is exactly what you want). Fixes: - #46496 - #33883 - #27597 - transistorsoft/react-native-background-fetch#202 - transistorsoft/react-native-background-fetch#369 - transistorsoft/react-native-background-geolocation#2096 - jpush/jpush-react-native#78 ## Stacktrace: ``` Fatal Exception: java.lang.AssertionError: Tried to finish non-existent task with id 28. at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:88) at com.facebook.react.jstasks.HeadlessJsTaskContext.finishTask(HeadlessJsTaskContext.java:179) at com.facebook.react.jstasks.HeadlessJsTaskContext$3.run(HeadlessJsTaskContext.java:217) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:368) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233) at java.lang.Thread.run(Thread.java:1012) ``` ## Screenshot https://github.com/user-attachments/assets/101f0f53-95c9-40ec-a59d-22d6d474b457 ## Changelog: [ANDROID] [FIXED] - Fix Headless Crash `Tried to finish non-existent task with id` Pull Request resolved: #46497 Test Plan: I created an example where I attempt to remove a task that doesn’t exist. Example: https://github.com/RodolfoGS/react-native-fix-non-existent-task ### How to reproduce using the example above: 1. `git clone [email protected]:RodolfoGS/react-native-fix-non-existent-task.git` 2. `cd react-native-fix-non-existent-task` 3. `npm install` 4. `npm run android` 5. Notice the crash ### Steps to create the example from scratch and reproduce the crash: 1. `npx react-native-community/cli@latest init AwesomeProject` 2. `cd AwesomeProject` 3. Add call to finishTask to reproduce the crash (RodolfoGS/react-native-fix-non-existent-task@6fe3c13) 4. `npm run android` 5. Notice the crash Reviewed By: javache Differential Revision: D62738059 Pulled By: rshest fbshipit-source-id: 3232dc76ba8a069279c2b741d62372537a3f9140
Summary: Sometimes a headless task tries to finish, but it doesn’t exist, which causes an exception. No one knows how to reliably reproduce it, as it could be a race condition. However, if you attempt to remove a task that has already been removed, it shouldn’t cause an issue since you're trying to remove something that’s already gone (which is exactly what you want). Fixes: - #46496 - #33883 - #27597 - transistorsoft/react-native-background-fetch#202 - transistorsoft/react-native-background-fetch#369 - transistorsoft/react-native-background-geolocation#2096 - jpush/jpush-react-native#78 ## Stacktrace: ``` Fatal Exception: java.lang.AssertionError: Tried to finish non-existent task with id 28. at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:88) at com.facebook.react.jstasks.HeadlessJsTaskContext.finishTask(HeadlessJsTaskContext.java:179) at com.facebook.react.jstasks.HeadlessJsTaskContext$3.run(HeadlessJsTaskContext.java:217) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:368) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233) at java.lang.Thread.run(Thread.java:1012) ``` ## Screenshot https://github.com/user-attachments/assets/101f0f53-95c9-40ec-a59d-22d6d474b457 ## Changelog: [ANDROID] [FIXED] - Fix Headless Crash `Tried to finish non-existent task with id` Pull Request resolved: #46497 Test Plan: I created an example where I attempt to remove a task that doesn’t exist. Example: https://github.com/RodolfoGS/react-native-fix-non-existent-task ### How to reproduce using the example above: 1. `git clone [email protected]:RodolfoGS/react-native-fix-non-existent-task.git` 2. `cd react-native-fix-non-existent-task` 3. `npm install` 4. `npm run android` 5. Notice the crash ### Steps to create the example from scratch and reproduce the crash: 1. `npx react-native-community/cli@latest init AwesomeProject` 2. `cd AwesomeProject` 3. Add call to finishTask to reproduce the crash (RodolfoGS/react-native-fix-non-existent-task@6fe3c13) 4. `npm run android` 5. Notice the crash Reviewed By: javache Differential Revision: D62738059 Pulled By: rshest fbshipit-source-id: 3232dc76ba8a069279c2b741d62372537a3f9140
Summary: Sometimes a headless task tries to finish, but it doesn’t exist, which causes an exception. No one knows how to reliably reproduce it, as it could be a race condition. However, if you attempt to remove a task that has already been removed, it shouldn’t cause an issue since you're trying to remove something that’s already gone (which is exactly what you want). Fixes: - #46496 - #33883 - #27597 - transistorsoft/react-native-background-fetch#202 - transistorsoft/react-native-background-fetch#369 - transistorsoft/react-native-background-geolocation#2096 - jpush/jpush-react-native#78 ## Stacktrace: ``` Fatal Exception: java.lang.AssertionError: Tried to finish non-existent task with id 28. at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:88) at com.facebook.react.jstasks.HeadlessJsTaskContext.finishTask(HeadlessJsTaskContext.java:179) at com.facebook.react.jstasks.HeadlessJsTaskContext$3.run(HeadlessJsTaskContext.java:217) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:368) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233) at java.lang.Thread.run(Thread.java:1012) ``` ## Screenshot https://github.com/user-attachments/assets/101f0f53-95c9-40ec-a59d-22d6d474b457 ## Changelog: [ANDROID] [FIXED] - Fix Headless Crash `Tried to finish non-existent task with id` Pull Request resolved: #46497 Test Plan: I created an example where I attempt to remove a task that doesn’t exist. Example: https://github.com/RodolfoGS/react-native-fix-non-existent-task ### How to reproduce using the example above: 1. `git clone [email protected]:RodolfoGS/react-native-fix-non-existent-task.git` 2. `cd react-native-fix-non-existent-task` 3. `npm install` 4. `npm run android` 5. Notice the crash ### Steps to create the example from scratch and reproduce the crash: 1. `npx react-native-community/cli@latest init AwesomeProject` 2. `cd AwesomeProject` 3. Add call to finishTask to reproduce the crash (RodolfoGS/react-native-fix-non-existent-task@6fe3c13) 4. `npm run android` 5. Notice the crash Reviewed By: javache Differential Revision: D62738059 Pulled By: rshest fbshipit-source-id: 3232dc76ba8a069279c2b741d62372537a3f9140
Same issue here |
Description
Hi there, I've seen this crash to happen much more since Android 12 and 96% Samsung devices.
I cannot reproduce and I do not use any library that uses Headless tasks.
Crashlytics:
Fatal Exception: java.lang.AssertionError: Tried to finish non-existent task with id 1.
at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:88)
at com.facebook.react.jstasks.HeadlessJsTaskContext.finishTask(HeadlessJsTaskContext.java:173)
at com.facebook.react.jstasks.HeadlessJsTaskContext$3.run(HeadlessJsTaskContext.java:211)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
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:228)
at java.lang.Thread.run(Thread.java:920)
Related #27597
Version
0.68.2
Output of
npx react-native info
npx react-native info
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.22000
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 10.64 GB / 31.92 GB
Binaries:
Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.11 - ~\AppData\Roaming\npm\node_modules\yarn\bin\yarn.CMD
npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
Watchman: 20200816.222424.0 - C:\sites\tools\watchman\bin\watchman.EXE
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 4.1.0.0 AI-201.8743.12.41.7199119
Visual Studio: Not Found
Languages:
Java: 11.0.14.1 - /cygdrive/c/Program Files/Eclipse Adoptium/jdk-11.0.14.101-hotspot/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.2 => 17.0.2
react-native: ^0.68.2 => 0.68.2
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Cannot reproduce it.
Snack, code example, screenshot, or link to a repository
No response
The text was updated successfully, but these errors were encountered: