{"action":"created","issue":{"url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5119","labels_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5119/labels{/name}","comments_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5119/comments","events_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5119/events","html_url":"https://github.com/WhisperSystems/Signal-Android/issues/5119","id":128354593,"number":5119,"title":"\"Bad encrypted message\" if ending a session arrives too late","user":{"login":"2-4601","id":174176,"avatar_url":"https://avatars.githubusercontent.com/u/174176?v=3","gravatar_id":"","url":"https://api.github.com/users/2-4601","html_url":"https://github.com/2-4601","followers_url":"https://api.github.com/users/2-4601/followers","following_url":"https://api.github.com/users/2-4601/following{/other_user}","gists_url":"https://api.github.com/users/2-4601/gists{/gist_id}","starred_url":"https://api.github.com/users/2-4601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2-4601/subscriptions","organizations_url":"https://api.github.com/users/2-4601/orgs","repos_url":"https://api.github.com/users/2-4601/repos","events_url":"https://api.github.com/users/2-4601/events{/privacy}","received_events_url":"https://api.github.com/users/2-4601/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-23T21:46:09Z","updated_at":"2016-01-28T20:43:25Z","closed_at":"2016-01-28T20:43:25Z","body":"Android seems to get confused if it receives end secure session message later than the messages sent after it.\r\n\r\n#### Steps\r\n1. In a conversation with an Android\r\n1. Android turns on airplaine mode\r\n1. I end the session\r\n1. I send three messages\r\n1. Android turns off airplaine mode\r\n1. Android receives two of my messages\r\n1. Android receives my end session message\r\n1. Android receives my third message and it is a _Bad encrypted message..._\r\n1. Android sees all subsequent messages from me as _Bad encrypted message..._\r\n1. If Android sends me a message everything works again\r\n\r\n![end session bad encrypted message](https://cloud.githubusercontent.com/assets/174176/12532857/3b40de20-c227-11e5-893a-58cb4eb97bdc.png)\r\n\r\nThe screen shots and logs are from Desktop 0.1.9 and Android 3.9.1\r\nBut I'm able to reproduce this just between two Androids as well.\r\n\r\nDesktop log: https://gist.github.com/anonymous/ca35e4cf3dee37325a7e\r\nAndroid spammy log: https://gist.github.com/anonymous/72461983b75eca46950a\r\n```\r\nW/PushDecryptJob(10541): org.whispersystems.libaxolotl.InvalidKeyIdException: java.io.FileNotFoundException: /data/data/org.thoughtcrime.securesms/files/prekeys/9348061: open failed: ENOENT (No such file or directory)\r\nW/PushDecryptJob(10541): \tat org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore.loadPreKey(TextSecurePreKeyStore.java:57)\r\nW/PushDecryptJob(10541): \tat org.thoughtcrime.securesms.crypto.storage.TextSecureAxolotlStore.loadPreKey(TextSecureAxolotlStore.java:56)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.libaxolotl.SessionBuilder.processV3(SessionBuilder.java:140)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.libaxolotl.SessionBuilder.process(SessionBuilder.java:112)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.libaxolotl.SessionCipher.decrypt(SessionCipher.java:183)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.libaxolotl.SessionCipher.decrypt(SessionCipher.java:153)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.textsecure.api.crypto.TextSecureCipher.decrypt(TextSecureCipher.java:148)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.textsecure.api.crypto.TextSecureCipher.decrypt(TextSecureCipher.java:119)\r\nW/PushDecryptJob(10541): \tat org.thoughtcrime.securesms.jobs.PushDecryptJob.handleMessage(PushDecryptJob.java:135)\r\nW/PushDecryptJob(10541): \tat org.thoughtcrime.securesms.jobs.PushDecryptJob.onRun(PushDecryptJob.java:115)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.jobqueue.JobConsumer.runJob(JobConsumer.java:76)\r\nW/PushDecryptJob(10541): \tat org.whispersystems.jobqueue.JobConsumer.run(JobConsumer.java:46)\r\nW/PushDecryptJob(10541): Caused by: java.io.FileNotFoundException: /data/data/org.thoughtcrime.securesms/files/prekeys/9348061: open failed: ENOENT (No such file or directory)\r\nW/PushDecryptJob(10541): \tat libcore.io.IoBridge.open(IoBridge.java:406)\r\nW/PushDecryptJob(10541): \tat java.io.FileInputStream.<init>(FileInputStream.java:78)\r\nW/PushDecryptJob(10541): \tat org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore.loadSerializedRecord(TextSecurePreKeyStore.java:172)\r\nW/PushDecryptJob(10541): \tat org.thoughtcrime.securesms.crypto.storage.TextSecurePreKeyStore.loadPreKey(TextSecurePreKeyStore.java:54)\r\nW/PushDecryptJob(10541): \t... 11 more\r\nW/PushDecryptJob(10541): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)\r\nW/PushDecryptJob(10541): \tat libcore.io.Posix.open(Native Method)\r\nW/PushDecryptJob(10541): \tat libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)\r\nW/PushDecryptJob(10541): \tat libcore.io.IoBridge.open(IoBridge.java:390)\r\nW/PushDecryptJob(10541): \t... 14 more\r\n```"},"comment":{"url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/comments/176404868","html_url":"https://github.com/WhisperSystems/Signal-Android/issues/5119#issuecomment-176404868","issue_url":"https://api.github.com/repos/WhisperSystems/Signal-Android/issues/5119","id":176404868,"user":{"login":"2-4601","id":174176,"avatar_url":"https://avatars.githubusercontent.com/u/174176?v=3","gravatar_id":"","url":"https://api.github.com/users/2-4601","html_url":"https://github.com/2-4601","followers_url":"https://api.github.com/users/2-4601/followers","following_url":"https://api.github.com/users/2-4601/following{/other_user}","gists_url":"https://api.github.com/users/2-4601/gists{/gist_id}","starred_url":"https://api.github.com/users/2-4601/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2-4601/subscriptions","organizations_url":"https://api.github.com/users/2-4601/orgs","repos_url":"https://api.github.com/users/2-4601/repos","events_url":"https://api.github.com/users/2-4601/events{/privacy}","received_events_url":"https://api.github.com/users/2-4601/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T20:43:25Z","updated_at":"2016-01-28T20:43:25Z","body":"I guess this is a stupid edge case and will be taken care of when the manual reset session option is not needed any more.\r\nClosing."}}