Intolerance against crashed services
TextSecure is not robust if its services are crashed/quitted. This may cause all kinds of bugs.
For example, follow the following steps to reproduce two problems.
- Bob: Kill service "KeyCachingService", but leave the "SendReceiveService" running
- Alice: Send message to Bob.
- Bob doesn't receive the message (delayed, issue #970)
- Bob: Restart phone.
- Bob: Receives bad encrypted messages (issue #763, a combination of cases 3 and 4).
I've also pulled a debug log: http://hastebin.com/xiniduluya (taken by Bob after step 5)
Finally - this reliably reproduces delayed as well as bad encrypted messages. Really hope it helps!
I would like to try reproducing this behaviour; how can I kill single services on Android?
It sounds very plausible to me that this is the source of #970 and #763 case 3+4. It would explain why I never receive "bad encrypted messages": I have a much more powerful phone (Nexus 4) than the contacts that I am messaging, and who get "bad encrypted messages" from me. So probably, Android never kills those services for me, but does so on less powerful devices.
@Natanji go into Settings -> Apps -> Active (Tab) -> TextSecure. There you can kill services by hitting the left button ("Beenden" on my screenshot).

I killed the service KeyCachingService and I received immediately a new message (No delayed messages, no bad encrypted messages). Only thing was: I had to reenter my password for TextSecure. Everything else is OK so far.
Edit: There was no need to reboot to receive the message.
@MPSMPS That's good to know. In my setup, there is no passphrase configured. Could you try again to reproduce without a passphrase? Thanks
@vascorppor I removed the passphrase but I also got the message almost immediately (no reboot necessary). But this time the message (only 1 was sent) was bad encrypted and shows up two times (with the same SENT timestamp) in the chat window. But I observed a really strange thing: In the chat window the message was marked as bad encrypted but in the "system tray (I don't know the correct name on android systems)" it was shown for a period of a few hundreds milliseconds (with decrypted content). So TextSecure was at least able to decode this message and show it in the system tray.
In my opinion a really strange behaviour...
HTH
EDIT: Even more strange behaviour: I set my old password for the DB (I don't know if it matters if it is different to the original one) and now I got a "new" message with the correct decrypted content from the bad encrypted message. SENT timestamp is the same as for the two bad encrypted messages.
I did the following steps:
- remove password for DB
- kill KeyCachingService
- receive Message A
- receive Message B
- set old password for DB
- receive new old Message A
Chat history is something like that: A (bad encrypted) but shown for a short time in the systray. A (bad encrypted) B (correct encrypted and decrypted) A (correct encrypted and decrypted, that content was also displayed in the systray), same SEND timestamp as first message A.
Possibly this was just a bad timing and GCM resent that message!?
GitHub Issue Cleanup: See #7598 for more information.