Commit e4d43e5
authored
Fix crash in Messaging on Android when Terminate is called while tasks are still pending. (#739)
* Andriod ANR
When firebase::messaging::Terminate is called while there are still pending tasks left a null pointer exception is causing an ANR on Andriod.
FutureData is destroyed before calling util::Terminate which in turn will try to cancel all pending callbacks. This will call cancel() in JniResultCallback.java which will lock a mutex and callback into C++ using the JniResultCallback_nativeResult function. Depending on the task canceled it will call into different callbacks in messaging.cc and some of them as for example CompleteStringCallback are using FutureData which has already been destroyed. This will cause the thread to stop and the mutex in JniResultCallbak.java to remain locked. The next message that either completes or fails will now end up in a dead lock causing an ANR.
The proposed fix is to not destroy FutureData until after the tasks have been canceled.
* Updated readme1 parent b7ca2e2 commit e4d43e5
File tree
2 files changed
+3
-1
lines changed- messaging/src/android/cpp
- release_build_files
2 files changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
707 | | - | |
708 | 707 | | |
| 708 | + | |
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
| 575 | + | |
| 576 | + | |
575 | 577 | | |
576 | 578 | | |
577 | 579 | | |
| |||
0 commit comments