Bug #763
closedThe Android demo (open-ecard-android) demonstrates a deadlock in Android-lib
0%
Description
Disclaimer: This problem is limited to the Android-specific libraries.
Problem:¶
A reproducible deadlock arises between the main activity thread (aka the UI thread), and a worker thread dedicated to the authentication process.
Steps to reproduce:¶
The problem arises when the Android activity lifecycle stops the activity, triggering a cancellation of the authentication process. This cancellation process will wait for the worker thread to terminate.
at.interrupt(); at.join();
However, the interrupt currently causes the worker thread to handle/notify the user of the process interruption and thus the worker thread requests for the cancellation dialogue from the UI thread, as seen here:
FutureTask<Dialog> t = new FutureTask(this::showCardRemoveDialog); parent.runOnUiThread(t);
Because the UI thread is stuck in the join, it will never execute the code in the FutureTask and both threads deadlock.