Project

General

Profile

Actions

Bug #763

closed

The Android demo (open-ecard-android) demonstrates a deadlock in Android-lib

Added by Neil Crossley about 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
08/22/2019
Due date:
% Done:

0%

Estimated time:
Reviewer:
Build Version:

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:

https://github.com/ecsec/open-ecard/blob/master/clients/android-lib/src/main/java/org/openecard/android/activation/AbstractActivationHandler.java#L441

        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.

Actions

Also available in: Atom PDF