Issue #609
Strongswan fails to disconnect - Android client
Description
We have been using the Android StrongSwan VPN client and have noticed that the app fails to disconnect properly. We're using a Samsung Galaxy tab 2 10.1 on Android Version 4.0.4. When attempting to disconnect, the app will just remain in the disconnecting state. After closer investigation on the source code and adding in a VPNStateListener, we have found that the State remains as "Disconnecting". This behaviour is not shown on any other of our Android devices including: Samsung Galaxy S5, Nexus 4, Samsung Galaxy S4, Samsung Galaxy S3 and HTC One X. Android Versions ranging from 4.2.2 - 4.4.2.
We have noticed that there was a bug raised last year that described similar behaviour:
http://wiki.strongswan.org/issues/298
Related issues
History
#1 Updated by Tobias Brunner over 11 years ago
- Related to Bug #298: Deadlock on charon deinit added
#2 Updated by Tobias Brunner over 11 years ago
- File 0001-threading-Workaround-for-pthread_cancel-if-pthread_s.patch 0001-threading-Workaround-for-pthread_cancel-if-pthread_s.patch added
- Tracker changed from Bug to Issue
- Status changed from New to Feedback
- Assignee set to Tobias Brunner
- Priority changed from High to Normal
We're using a Samsung Galaxy tab 2 10.1 on Android Version 4.0.4.
According to Wikipedia an update to Android 4.2.2 should be available for that device (or at least to 4.1.2).
When attempting to disconnect, the app will just remain in the disconnecting state.
...
We have noticed that there was a bug raised last year that described similar behaviour:
http://wiki.strongswan.org/issues/298
It's a known issue and kinda related to #298. The problem is that Android versions before 4.1 implemented pthread_sigmask()
incorrectly (this commit fixed it). Which means that on older Android releases threads might get canceled when they are not in a cancelable state and are e.g. holding locks, which could lead to a deadlock during shutdown.
Attached is a patch I had lying around that provides a workaround for Android < 4.1. I haven't applied it upstream so far because I prefer the current implementation and the workaround is only required for old Android versions with an ever decreasing market share.
#3 Updated by Le Hoang about 11 years ago
I applied the patch and it seems to be working. Thanks a lot.
#4 Updated by Le Hoang about 11 years ago
After some more rigorous testing, we have found that the problem still persists even with the patch. When the patch is applied, the problem does not disappear but only occurs less frequently. How much has this patch been tested?
#5 Updated by Tobias Brunner about 11 years ago
How much has this patch been tested?
Hasn't been tested at all.
#6 Updated by Tobias Brunner about 10 years ago
- Status changed from Feedback to Closed
- Resolution set to Won't fix