Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop client sending contacts many "Message encrypted for non-existing session" #2806

Closed
neilr8133 opened this issue Oct 19, 2018 · 61 comments

Comments

@neilr8133
Copy link


Bug description

Signal desktop client was offline for a while. Launched it, and I believe updated to 1.16.3 before I tried to use it. At 2018-10-18T13:13:09.620Z Sent a message to an existing conversation, but Signal on my phone popped up a message "from me" with content "Message encrypted for non-existing session." The recipient (on a different platform) received a similar message (but worded a little differently, if I recall correctly). The original message content was never received on my phone nor on the recipient's platform, but is visible in my Desktop app

Steps to reproduce

Unable to reproduce, when I sent a new message (the next day) it worked fine.

Platform info

  • Signal Desktop Client, currently 1.16.3 (me)
  • Signal Android Client, 4.26.2 (me)

Operating System:

  • Windows 7 x64

Linked device version:
Android version: 9

Link to debug log

@GuardianMajor
Copy link

I had the same issue (signalapp/Signal-Android#7982) that also involved the Desktop client as well as other party being on Mac, but I was told to report it on Android (my anchor device), hoping you get some traction as I want to know why it happened and it was never addressed.

@jongleur1983
Copy link

jongleur1983 commented Nov 5, 2018

Same problem here, and no single message is send successfully (Desktop Client 1.17.3 on Windows 10). The deprecated chromium-based client works.

This can be "fixed" by first sending a message from the mobile app on the phone. This seems to synchronize the connection somehow.
Not sure if receiving a message from the contact works as well, didn't test that yet.

@scottnonnenberg-signal
Copy link
Contributor

@GuardianMajor @jongleur1983 It's only somewhat useful to know that you're running into this behavior as well - after all, we can't know for sure if it is the same issue without debug logs. Please, whenever commenting on other bugs like this, treat it like your own bug report, with full details, including debug logs.

@jongleur1983
Copy link

@scottnonnenberg-signal I got it working before looking for it to be an actual bug. If it's still useful to generate the debug logs a day later I'll do it tomorrow (when I'm back at the same machine).

@GuardianMajor
Copy link

@scottnonnenberg-signal I understand and agree, that's why I linked to the issue where I did provide all that I could and then some, but no one ever did anything or even acknowledge it, so it is hard to help when no one seems to want it. Tell me what you need and I will happily give it to you but I have long accepted that these dead messages that shouldn't be and I will never have access to them, which is not right but what can I do but move on.

@scottnonnenberg-signal
Copy link
Contributor

@neilr8133 The explanation for a message from yourself is that your devices communicate with each other. You can see a sent message from yourself on all of your devices, but only one device sent that message. It's because the original sender 'synced' that message to its sibling devices.

What you saw was a desktop waking up after a long time and sending broken messages to sibling devices and devices owned by your contact.

So, exactly how long was 'a while' since you had previously opened desktop? What else can you say about your usage of your primary device? How many messages do you send/receive every day?

@GuardianMajor
Copy link

@scottnonnenberg-signal Just on the issue of sync, I have noticed as well that the stable version running on my wife's machine does NOT update to messages exchanged unless it is expressly open at the time the messages come, otherwise, no update whatsoever when you open it.

@scottnonnenberg-signal
Copy link
Contributor

@GuardianMajor We'd love to see some logs from that desktop instance!

@jongleur1983
Copy link

@scottnonnenberg-signal in my case your question to @neilr8133 seems to be a very likely reason: I installed the native desktop client when it was announced initially by the chromium-based one, but forgot to exchange the shortcut in my taskbar, so I always opened the old one again after a reboot. The native client thus didn't run for weeks in between. My primary device receives >=5 messages per day, usually much more, very rarely less.

@GuardianMajor
Copy link

@scottnonnenberg-signal I have provided them before in other issues but I will be happy to do that, I will get that worked out and sent to you ASAP. Thanks.

@alexischuck
Copy link

alexischuck commented Jan 14, 2019

I may have encountered this issue just now, came here via @anantpaatra's Reddit thread after receiving 100+ "Message encrypted for non-existing session" messages on my Android phone from one contact (who usually uses an iPhone, eta: but just opened the macOS app ) within the space of a few seconds. I tried "Reset secure session" to no avail. I ended up blocking the offending number so that I could use my phone again as only other way to stop the messages was to disable WiFi.

https://debuglogs.org/d994eb05a825fc2f1b67cecc2af4c96167e07fb81a58322da1d9ed529ab15d9b

@yaomtc
Copy link

yaomtc commented Jan 22, 2019

Having just launched Signal on my Windows workstation for the first time in a couple months (and shortly updating itself), Signal apparently decided to spam several of my contacts with a bunch of messages that inevitably failed.

https://user-images.githubusercontent.com/5534045/51508726-898c9c80-1dc4-11e9-8825-e112293c2baf.png

https://debuglogs.org/9379b8cf9d298bfaff45b4c226656fb0e463f97ef15c332105cc48af6467a16f
EDIT: that was the debug log from my desktop client, which might not be all that useful. I'll try to grab one from someone who got these messages...

Here's the log from my Android client that did get a few of those error messages today:
https://debuglogs.org/7d7d89aadf95db3068a6ac582e8cd5719b891969248692242a291185ff17be32

And here's a log from somebody else.
https://debuglogs.org/40100d37812cb22a746434fcb6fb47a8957f01cd4cef8607317c63909a241a77

I'm guessing those messages were being sent out before the update happened. There apparently aren't as many error messages as there were actual messages since the last time I was using this computer, so it probably got cut off... but at least one contact ended up with at least 55 error messages.

@tmadeira
Copy link

Same issue here: launched Signal Desktop for the first time in a couple months and it spammed my contacts with "message encrypted for non-existing session".

Signal Android v4.32.8
Signal Desktop v1.20.0 on Mac

@adrw
Copy link

adrw commented Jan 22, 2019

Same here while communicating with contacts on Signal Android.

Signal iOS v2.34.0.25
Signal Desktop v1.20 on Mac

@scottnonnenberg-signal scottnonnenberg-signal changed the title "Message encrypted for non-existing session" from desktop client Desktop client sending contacts many "Message encrypted for non-existing session" Mar 1, 2019
@dlpeatman
Copy link

Seems like I've come across the same issue others are explaining. I mainly use the Android client (a few messages a day). I opened the Windows desktop client for the first time in a while (a couple months?). While it was loading messages, I restarted the client after it prompted for updates (not sure if that caused the following). Then several of my contacts (and my Note to self) got spammed with "Message encrypted for non-existing session" messages.

Android logs: https://debuglogs.org/92028ae3e2f6afa2113953ccc40bfb71d96475a759a926b0b78cdbc945c009b9
Windows desktop logs: https://debuglogs.org/c040062464acc4aaec99d1cea194b548242a4d31e512d86962b37ff5146ec141

@dan4334
Copy link

dan4334 commented May 26, 2019

My contacts just got spammed with the same "Bad encrypted message" and "Message encrypted for non-existing session" as the screenshots in issue #3061 show.

This was caused by me launching the Signal Desktop app on Manjaro Linux for the first time in months. I'd just updated my system so it's running the latest packages and signal desktop version 1.24.1

It didn't come up with the "loading messages" screen it just took me to the UI and started downloading messages in the background (which I think is what set off the spam)

Closing the app immediately stopped the messages, and launching it again brought up the "Loading messages" screen and all my messages caught up and it did not spam anyone further.

Here's a debug log I was able to get after relaunching the app, hope it's useful in fixing the issue as it is quite stressful to suddenly get calls in the evening from people wondering why you're sending them weird messages!

https://debuglogs.org/f8d63b12466b61e3c9192b16a120493d9a8e9c208d7a90efc69c259ad0435ec2

@GuardianMajor
Copy link

Yeah one of my contacts got hit with the same, but ironically nothing on my end of the same conversation. So she reset her session with me and it seems to have fixed it but all the stuff that is now obscured as that warning, are gone and worthless.

@asdfCYBER
Copy link

asdfCYBER commented Jun 9, 2019

@scottnonnenberg-signal I just had this issue too, and I think I know what happened:
I left my pc in hibernate for an extended period of time (a month or two), and when starting it again Signal Desktop was still running. It did not say the usual 'Signal is retrieving messages' and went straight to the normal contact/menu screen where I left it on hibernate.
An update was also pushed during hibernate, and many messages were sent during that time from other devices. Either of these two may have caused signal to bug out. My proposal (I won't push it myself since I am not familiar with your code) is to compare the time Signal was last active to the system clock, and force a restart when that time exceeds a day or so. I'm not sure about the trigger, but I think forcing a restart will solve this problem.
Edit: desyncing after a while might help too

@tuxayo
Copy link

tuxayo commented Jun 9, 2019

I just had this issue too.
After maybe a month of having the app closed. The opening seemed normal, processing a lot of messages.
Although I though I would take more than an hour given the past durations of startups just after a week of inactivity.

What additional can I provide to help with this?
I have another desktop device inactive for more time that I can start to see if my contacts will get spammed again... ^^"

Platform Info

Signal Version: 1.25.1

Operating System: Arch Linux

Linked Device Version:
4.40.4

Link to Debug Log

https://debuglogs.org/c8ce9d64267e0006be2d3d2f5a95db1e3b408333988549acc9dcb165e78b6272

In most cases, a log from your other devices is also useful:
Android client:
https://debuglogs.org/739b60681448a0e78585cf0163efa1679cb3691a2c11f7c805814210fcb5f021

@tuxayo
Copy link

tuxayo commented Jun 9, 2019

Although I though I would take more than an hour given the past durations of startups just after a week of inactivity.

Actually the desktop app didn't get all the messages.

edit: and at least part of my contacts had to reset the session.

@tuxayo
Copy link

tuxayo commented Jun 9, 2019

Here are the debug logs of one of my contact that was impacted by this issue happening https://debuglogs.org/6aca53dac04984993b4469f0135df671e5b65a912c915dc8f614062269ee35f4

@kenpowers-signal
Copy link
Contributor

@tuxayo yes you can go ahead and reset the secure session in your notes to self conversation.

A few questions for you -- when was your desktop instance initially set up and when did you last successfully receive a message in your note to self conversation?

@Brog33
Copy link

Brog33 commented Sep 1, 2019

My desktop client is spamming both myself (note to self) AND my contacts/channels with error messages after I hadn't launched it for about two months. I thought this bug was fixed a long time ago.
This spam-bug has been featured in several issues, and last I remember it was closed with the solution that it now was required to re-link a linked client if it hadn't been active in over 30 days?

@scottnonnenberg-signal
Copy link
Contributor

@Brog33 We have seen some cases where Desktop forces itself to remain active in these situations where it has been offline for a very long time. In the future, please provide a debug log whenever you file a bug. At this point, it's likely that we've lost those key entries from that crucial launch after a long delay.

@Brog33
Copy link

Brog33 commented Sep 6, 2019

In the future, please provide a debug log whenever you file a bug. At this point, it's likely that we've lost those key entries from that crucial launch after a long delay.

Ok.
Just got 4 more "Error handling incoming message" => No session found to decrypt message. Spammed to one of my contacts.

Sent | Friday, September 6, 2019 2:02 PM (1567771378421)
Received | Friday, September 6, 2019 10:41 PM (1567802467619)

Sent | Friday, September 6, 2019 2:04 PM (1567771456497)
Received | Friday, September 6, 2019 10:41 PM (1567802468427)

Sent | Friday, September 6, 2019 2:05 PM (1567771525440)
Received | Friday, September 6, 2019 10:41 PM (1567802469240)

Sent | Friday, September 6, 2019 2:40 PM (1567773646174)
Received | Friday, September 6, 2019 10:41 PM (1567802470533)

https://debuglogs.org/992ca7ac10d763d6697987866e26f17c86c2bfcf9af21ae854e0cb66d56cc7e4

@scottnonnenberg-signal
Copy link
Contributor

@Brog33 Please update to v1.27.1. We've made changes which should prevent that in the future.

@Brog33
Copy link

Brog33 commented Sep 10, 2019

@Brog33 Please update to v1.27.1. We've made changes which should prevent that in the future.

Hmm well, that didn't work. I'm using 1.27.2 now and still getting these "Error handling incoming message". They just keep on coming.

https://debuglogs.org/3577820d05ebffcaf184c06a7e90406c9b6517d30aa3e787fa927a5f6a44db16

@scottnonnenberg-signal
Copy link
Contributor

@Brog33 it could be problems with your contacts' devices, or these conversations are in bad shape and it need a 'reset session.' We'd be happy to talk further about your specific situation, and the specific conversations where you're seeing these errors. Please feel free to reach out to [email protected]

@egtann
Copy link

egtann commented Sep 24, 2019

@scottnonnenberg-signal I just had this happen to all my contacts. v1.27.2 on Ubuntu 19.04.

Same exact scenario as the OP. Signal for desktop was offline since July 10. Opened it and it immediately sent hundreds of messages "from me" containing "Bad encrypted message" and "Message encrypted for non-existing session" and "No available session for contact". My contacts all called me in the middle of the night wondering if I was trying to get hold of them with them receiving dozens of empty messages (in one case hundreds!). This affected contacts across Android and iOS.

I was able to continue in my conversations over Signal on desktop without resetting any sessions though. In "Note to self" I had to reset the session to get notes to come through.

@VorpalBlade
Copy link

VorpalBlade commented Oct 15, 2019

Also seeing this problem after not having used signal-desktop for a while. I did not have to reset any sessions though. This has happened twice now, when not using Signal Desktop for a while (1-2 months) and then opening it.

EDIT: Also not all messages were successfully synced from all conversations to my desktop. Some of the more recent ones are missing.

Ubuntu 16.04 and Signal 1.27.4

@StephanieKemna
Copy link

Same issue here, I did not use Signal desktop for over a month, just started it and as I started it, my contacts got spammed with "Message encrypted for non-existing session" as well as "Bad encrypted message". I noticed because I have a "Note to Self" and got it as well, and two of my contacts alerted me.
When the desktop version was started, it did not have all latest messages, it was still stuck on an old state.

Both my desktop (Ubuntu 16.04) and app (Android 8.1.0) were on outdated versions of Signal, I did not check the versions before I updated. Both are updated now, I deinstalled signal-desktop (app remove) and reinstalled (app install) and then it started up fine, but it still does not have all latest messages showing, only for some conversations.
I'm now on Signal 4.49.18 on phone, and v1.28.0 on desktop
Gonna go relink desktop..

@scottnonnenberg-signal
Copy link
Contributor

@StephanieKemna I'm sorry you ran into that. If you provide your debug logs (View -> Debug Log), we may still be able to figure out which version you came from. That would help us determine if there's anything still for us to change here.

@VorpalBlade
Copy link

I just tried it again with the latest version (Android 9 with Signal 4.49.18; Ubuntu 16.04 with Signal 1.28.0). Haven't opened Signal for several weeks again on the desktop. Same issue.

I saved the debug log, though I don't want to put it out in public in full. I'm okay with sharing it personally with a Signal developer.

There are however a lot of tracebacks in the log that might be of interest:

ERROR 2019-11-19T14:00:27.155Z _runJob: Failed to download attachment type attachment for message +[REDACTED]692.1 1571572244925, attempt 2: HTTPError: promiseAjax: error response; code: 403
    at HTTPError ([REDACTED]/app.asar/js/modules/web_api.js:379:13)
    at [REDACTED]/app.asar/js/modules/web_api.js:335:13
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
Original stack:
Error
    at _outerAjax ([REDACTED]/app.asar/js/modules/web_api.js:373:19)
    at Object.getAttachment ([REDACTED]/app.asar/js/modules/web_api.js:870:14)
    at MessageReceiver.downloadAttachment (file://[REDACTED]/app.asar/js/libtextsecure.js:39430:41)
    at _runJob ([REDACTED]/app.asar/js/modules/attachment_downloads.js:191:42)

Issues observed:

  • Most messages did not in fact sync.
  • Several "Notes to Self" showed up on the phone marked "Message encrypted for non-existing session".

I don't know yet if it also spammed other people like before, since I cannot see that myself.

@scottnonnenberg-signal
Copy link
Contributor

@VorpalBlade Please send your logs to [email protected]. Maybe if you could talk about what does work for you (like what are your normal working patterns, how do you generally use Signal Desktop), that would help us determine where the problems are?

@StephanieKemna
Copy link

Thanks for looking into this! I'm sending the debug log to [email protected] now.

@VorpalBlade
Copy link

I have sent the log file.

@lapp0
Copy link

lapp0 commented Jan 4, 2020

I have managed to reproduce this issue when using two separate signal clients through the following steps:

  • Alice: have signal desktop running, but ensure signal android is not running
  • Bob: send ~100 messages to Alice
  • Alice: read ~100 messages on signal desktop
  • Bob: reset secure session
  • Bob: send ~100 more messages to Alice
  • Alice: read ~100 more messages on signal desktop
  • Alice: start signal android and process ~200 message backlog
    • results in Alice sending ~100 "message read" notifications to Bob before Alices client handles the reset secure session
      • this results in ~100 "bad encrypted message" notifications for Bob
    • the next ~100 "message read" notifications sent after the secure session was reset should be fine, however

There are a few ways I think "bad encrypted message" spam could be mitigated, let me know what you think:

  • signal could make sure it's completely synced and has the latest session token before sending "message read" notifications
  • signal could consolidate all "bad encrypted message" notifications into a single message
    • this should "update existing notification" if another bad encrypted message is encountered. It should say "received N bad encrypted messages" and increment N for each update
  • create a setting to retain old session tokens, and annotate messages which use old tokens with a warning
  • finally, the simplest fix is to just create a setting to disable "bad encrypted message" notifications

@tuxayo
Copy link

tuxayo commented Jan 21, 2020

@kenpowers-signal

@tuxayo yes you can go ahead and reset the secure session in your notes to self conversation.

Thanks :)

A few questions for you -- when was your desktop instance initially set up

According to the file timestamps in the content of ~/.config/Signal
2017-11-05
or
2018-06-08
I'm not sure which one. Should I keep investigating?

and when did you last successfully receive a message in your note to self conversation?

I didn't use it often.
On the phone: last good message from desktop: 2019-02-19, next message, which was corrupted: 2019-06-09

Is there more info that I can try to find?

@asdfCYBER
Copy link

This issue has been open for a year and a half now, and we haven't seen any progress.
It is still labeled "Need information", but it is unclear what information is missing and why this is not labeled as a bug. For me, this means I can't use Signal Desktop without risking it spamming every contact. Could you please be more transparent in your progress of fixing this bug?

@tuxayo
Copy link

tuxayo commented Mar 7, 2020

For me, this means I can't use Signal Desktop without risking it spamming every contact.

My workaround is use Signal Desktop at least every two weeks, I think it's safe up to that duration.

Does anyone else has a precise idea about the inactive time required to get this bug?

@tuxayo
Copy link

tuxayo commented Mar 7, 2020

This means that if I can't use Signal Desktop for more than a month (that's my guess), I would have to wipe the app data and redo the pairing. Which means loosing the whole history.

Another workaround would be to try to rely on bug #2904 (if it still happens, I didn't retry because of this very bug ^^). Which means to close Signal when it starts processing new message to get them dropped.

@scottnonnenberg-signal
Copy link
Contributor

@tuxayo You can unlink a desktop instance in your phone; when it starts up it will ask to be relinked to your phone, but no messages will be deleted. Note that any message not yet downloaded at the point of the unlink will be deleted from the server's queue.

@tuxayo
Copy link

tuxayo commented Mar 9, 2020

Thanks now we have a reliable workaround for instances that have been inactive for too long.

@tuxayo
Copy link

tuxayo commented Mar 9, 2020

Is there anything users could do to provide the developers more info about this bug?

Are there places in Signal-Desktop that could be made more verbose so our logs would be more helpful?

@Anntoin
Copy link

Anntoin commented Jan 18, 2021

I'm surprised this bug hasn't been given more attention.
I'd really like to use signal desktop but I'm not willing to run the risk of spamming all my contacts (I'd like them to stay on signal!).

Can one of the Devs comment on the reproduction steps and proposals from lapp0 above?

@StephanieKemna
Copy link

I haven't had this issue anymore, but my procedure now any time before opening desktop is to (1) make sure mobile app is latest version, (2) make sure desktop app is latest version. Never open desktop app before it has been updated.
It is tedious .. but it's been ok with that so far.

@stale
Copy link

stale bot commented Sep 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 24, 2021
@stale
Copy link

stale bot commented Oct 1, 2021

This issue has been closed due to inactivity.

@stale stale bot closed this as completed Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests