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 Suspend/Resume Decouples Mobile Synchronization #6103

Open
apiziali opened this issue Sep 2, 2022 · 98 comments
Open

Desktop Suspend/Resume Decouples Mobile Synchronization #6103

apiziali opened this issue Sep 2, 2022 · 98 comments
Labels

Comments

@apiziali
Copy link

apiziali commented Sep 2, 2022

  • [X ] I have searched open and closed issues for duplicates

The recently closed bug report "[Linux: Signal doesn't reconnect after sleep or lock screen] #6027" looks quite similar to the issue I am seeing.

  • [X ] I am using Signal-Desktop as provided by the Signal team, not a 3rd-party package.

Bug Description

When I suspend and subsequently resume my Ubuntu 18.04 PC, the message queue of Signal Desktop no longer remains synchronized with my Signal Android. Every time I resume the PC, I need to restart Signal to see the latest messages already delivered to the mobile phone.

One other environment consideration is that this is a multi-user PC, with each of the two users logged in and running Signal. However, I believe I have seen the synchronization failure with only one active user session.

Steps to Reproduce

  1. Boot the Ubuntu 18.04 workstation ("elijah").
  2. Log into elijah.
  3. Signal Desktop is started by the Ubuntu Startup Applications, using the command: /usr/bin/signal-desktop --use-tray-icon --start-in-tray %U
  4. Double-click the desktop icon "Sleep Until Tonight." This invokes the shell program ~/bin/sleep_until_tonight. That program suspends the workstation using the command: rtcwake --mode mem --utc --time [WAKEUP_TIME], where "[WAKEUP_TIME]" is a valid time to resume, such as "1662094200." "rtcwake --mode mem" puts the workstation in ACPI state 3.
  5. Wait for a few Signal chats to be delivered to the mobile app.
  6. Resume elijah.
  7. Those new chats are absent in Signal Desktop.
  8. Quit Signal Desktop.
  9. Restart Signal Desktop.
  10. The chats delivered to the mobile app are now displayed in Signal Desktop.

Actual Result:

Chats that were delivered to the mobile app are not delivered to the desktop application, as described in "Steps to Reproduce."

Expected Result:

When the workstation is resumed, Signal Desktop ought to reflect the chats that were delivered while the workstation was suspended.

Screenshots

Platform Info

Signal Version:

5.56.0 ... Production.

Operating System:

Ubuntu 18.04.6 LTS (uname -a : "Linux elijah 5.4.0-124-generic #140~18.04.1-Ubuntu SMP Fri Aug 5 11:43:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux")

Linked Device Version:

Samsung Galaxy A21, Android 11, One UI Core 3.1.

Link to Debug Log

https://debuglogs.org/desktop/5.56.0/33574877e6a4c8cdbd74fec3f7f09269a6c0281d6bb5a25e0a0db48626841da5.gz
https://debuglogs.org/android/5.47.3/83a1078f72b089d5d0f5996e170a937b768ab035e7ab9456d2141516ce61d8a4

debuglog.txt

@timp34
Copy link

timp34 commented Sep 14, 2022

I have same issue on Debian 11 with Xfce. Screen lock will also cause same issue. Can provide debug log if required.

@scottnonnenberg-signal
Copy link
Contributor

@apiziali So, at a high level I can say that when Desktop is not staying up to date with incoming messages after resume, it is in fact unable to access its database at all (we timeout after two minutes waiting to talk to our database). It makes me think that on your machine, inter-process communication (IPC, a core part of our Electron foundations) is broken. This is 100% reproducible for you? Can you tell us more about your linux install, window manager, etc.?

@timp34 Can we get a log from you?

@apiziali
Copy link
Author

apiziali commented Sep 14, 2022 via email

@timp34
Copy link

timp34 commented Sep 15, 2022

Here is my log. This is whilst signal appears to be working ok. Will add another shortly when it is "not" working correctly... :)
https://debuglogs.org/desktop/5.58.0/659cdb98ebc7cdf5e53a27ac6529ddb95440c79a642a1a4850517500cf6ffbfb.gz

@apiziali
Copy link
Author

Rather than habitually restarting Signal Desktop each time I resume the workstation, I just resumed without restarting it. After sending a "Note to Self" from my phone, it did not appear on the desktop. I immediately captured a debug log from the desktop:

https://debuglogs.org/desktop/5.58.0/05e264ed0b151de8f23332850112e1dbfc9212fec1183b604e3ffebb133f090c.gz

@timp34
Copy link

timp34 commented Sep 16, 2022

here is debug log for desktop that is now not sending or receiving after computer has been "suspended". Linked phone has new messages which are not on desktop version,
hope this helps...
https://debuglogs.org/desktop/5.58.0/616fb48cf70528e9e7a6d3b7cf68e4a50e917367c37a9aad34b79ec1f5b5989c.gz

@apiziali
Copy link
Author

I just noticed another clue. When Signal Desktop does not reflect recent messages delivered to Signal Android, the Ubuntu notification system still displays the first line or two of new messages. If one of those summaries is clicked, a GSConnect window, "Messaging: Andy's Phone," opens. Its left pane displays "No Conversations" which its right pane displays "No conversation selected. Select or start a conversation." GSConnect notifications are enabled in the Gnome notification settings. However, in Tweaks, GSConnect is turned off.

This may just reflect that GSConnect is reporting new messages received by Signal Android, so I could disable the GSConnect notifications on the Ubuntu workstation.

@apiziali
Copy link
Author

I've disabled GSConnect notifications on my workstation until we resolve this Signal Desktop synchronization failure.

@apiziali
Copy link
Author

FYI, GSConnect (https://bit.ly/3BrRUIg) is a re-implementation of KDE Connect for Gnome, which provides phone/desktop communication and control.

@indutny-signal
Copy link
Contributor

Very interesting! Thank you for investigating it. I'll file a bug internally, but would you care to submit this to Electron as well? It sounds like they might be interested in it too!

@apiziali
Copy link
Author

It looks to me as though GSConnect reporting new Signal Android messages, even though GSConnect is disabled in Gnome, is a red herring with regard to Signal Desktop and Signal Android losing synchronization. We need to understand why synchronization is lost.

@scottnonnenberg-signal
Copy link
Contributor

@apiziali @timp34 Hey there! We now have an Electron Fiddle ready for you to test.

  1. First, download Electron Fiddle here: https://www.electronjs.org/fiddle
  2. Then load up this Gist inside Electron Fiddle: https://gist.github.com/scottnonnenberg-signal/fc5174e6015c61fdae49ffe767d441bc
  3. Then start it up on a recent version of Electron. Currently Signal Desktop is on 20.1.4.
  4. Open the dev tools with View -> Toggle Developer Tools and watch the IPC ping/pong events go by.
  5. Suspend your linux machine, then resume it. See if the ping/pong events continue, or just ping with no pong. If just ping then IPC has broken, just like it has with your Signal Desktop.

You can try lots of different versions of Electron really easily within Electron Fiddle, and you can also create packaged versions to see if that makes a difference too (Tasks -> Package Fiddle).

Please let us know what you find! This is the kind of thing that will give us really useful information to pass to Electron so they can get things fixed!

@apiziali
Copy link
Author

apiziali commented Sep 24, 2022 via email

@apiziali
Copy link
Author

apiziali commented Oct 5, 2022

Scott, following your instructions, I ran the test using Electron 20.1.4 and annotated the results in your message below. As you can see, without even introducing suspend/resume, no "pong" event are reported in the console:

===============
Hey there! We now have an Electron Fiddle ready for you to test.

First, download Electron Fiddle here: https://www.electronjs.org/fiddle
-- Done

Then load up this Gist inside Electron Fiddle:
https://gist.github.com/scottnonnenberg-signal/fc5174e6015c61fdae49ffe767d441bc
-- Downloaded
-- Unzipped

Then start it up on a recent version of Electron. Currently Signal
Desktop is on 20.1.4.
-- Started Electron Fiddle ("electron-fiddle >/tmp/ef.log 2>&1 &")
-- Downloaded Electron version 20.1.4 from File > Preferences > Electron
-- Changed the version of Electron to 20.1.4
-- Load the Gist: File > Open > /home/andy/Signal Suspend-Resume Failure/Gist/
fc5174e6015c61fdae49ffe767d441bc-8ff8c17d37c693586c08ea16704a49ca259a23af
-- Open the console
-- Run the Gist: [Run]

Open the dev tools with View -> Toggle Developer Tools and watch the IPC
ping/pong events go by.
-- Only "pings" are logged in the console, even though no suspend/resume
cycles have been initiated:

------------
Console ready
Saving files to temp directory...
Saved files to /tmp/tmp-18764-ZrmqHuvlUq40
Electron v20.2.0 started.
main ping #1
main ping #2
main ping #3
main ping #4
main ping #5
main ping #6
main ping #7
main ping #8
main ping #9
main ping #10
main ping #11
main ping #12
main ping #13
main ping #14
main ping #15
main ping #16
main ping #17
main ping #18
main ping #19
main ping #20
main ping #21
main ping #22
main ping #23
main ping #24
main ping #25
main ping #26
main ping #27
main ping #28
main ping #29
main ping #30
main ping #31
main ping #32
main ping #33
main ping #34

Electron exited with code 0.
------------

...

@scottnonnenberg-signal
Copy link
Contributor

@apiziali Your pasted log output is from the main process, which isn't where you'll see the 'pong' result. You need to start up the app, and open the dev tools with View -> Toggle Developer Tools and you should see both 'ping' and 'pong.'

@apiziali
Copy link
Author

apiziali commented Oct 5, 2022

Scott,

There are no “pings,” nor “pongs” logged in the developer console (see attached).
Screenshot from 2022-10-05 14-29-17

I have not changed any of the default Electron Fiddle settings.

Also, "Toggle Developer Tools" is at: Help > Toggle Developer Tools

@scottnonnenberg-signal
Copy link
Contributor

I think you need to run the Electron Fiddle and enable the dev tools in the running application, not the Electron Fiddle editor application.

@apiziali
Copy link
Author

apiziali commented Oct 5, 2022

I have never used Electron Fiddle before, so I do not know how to enable the developer tools in the running application.

@scottnonnenberg-signal
Copy link
Contributor

Open the View menu and click Toggle Developer Tools in the running application when you choose to Run the code with Electron Fiddle. You can also package the application up and run it as a standalone application, maybe more easily tested.

@apiziali
Copy link
Author

apiziali commented Oct 5, 2022

Okay. I now realize that you are referring to View > Toggle Developer Tools in the application (Chrome?) menus, not in the Electron Fiddle menus. I've run four suspend/resume cycles, at 1-, 2-, 4- and 8-minute intervals between the suspend and resume. In each case, the ping/pong continues. What log files do you want me to capture, and how do I do so? Thanks!

@scottnonnenberg-signal
Copy link
Contributor

@apiziali The best thing to do would be to do whatever seemed to cause the problem with Signal Desktop. We're looking to replicate that suspend/resume problem, which we believe would mean that the ping/pong would become just ping.

@apiziali
Copy link
Author

apiziali commented Oct 5, 2022

Curiously, while running these tests, without restarting Signal, it continued to remain synchronized with Signal Android, as indicated by "Message to self" and a message sent from another user.

@apiziali
Copy link
Author

apiziali commented Oct 5, 2022

Alright, I will just leave this application running as we use the workstation normally, suspending and resuming it throughout the day. Shall I just copy-and-paste the application console log when Signal Desktop loses synchronization with Signal Android?

@scottnonnenberg-signal
Copy link
Contributor

@apiziali Certainly we're interested in whether this behavior still happens for you on Signal Desktop. The key bit of data we're looking for is whether, when it happens on Signal Desktop, it also happens on Electron Fiddle. We're looking for the minimum bit of code that can cause the weirdness on your system to trigger.

@apiziali
Copy link
Author

apiziali commented Oct 7, 2022

Signal Desktop has not lost synchronization with Signal Android since I started running your Gist. I then stopped the Gist in Electron Fiddle, but continued using the workstation and Signal as usual. Still, Signal Desktop remains synchronized. I quit the Electron Fiddle application and will monitor the behavior of Signal Desktop during the next few days of multiple suspend/resume cycles.

This is a classic problem, right? You begin to investigate and diagnose an issue and it ceases to exist. Causal? Who knows?

@scottnonnenberg-signal
Copy link
Contributor

@apiziali It would be preferable to us if you kept the electron fiddle app running in the background all the time along with Signal Desktop, just to gather as much data as possible.

@apiziali
Copy link
Author

apiziali commented Oct 7, 2022

Okay. I'll start it up again and we'll see if Signal loses synchronization. If it does, we'll have the fiddle app log.

BTW, where will I find this log file?

@scottnonnenberg-signal
Copy link
Contributor

@apiziali When Signa Desktop stops working, all we need is the Signal Desktop log and the yes/no of whether Electron Fiddle is doing the full ping/pong in its dev tools, or just ping.

@fhackenberger
Copy link

I can confirm this still being an issue on Ubuntu 23.04 with:

App version: 6.46.0
Environment: production
Linux version: "Ubuntu 23.04"
Node version: 18.17.1
OS version: #40-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:18:00 UTC 2023
Time: 1708611358467
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Signal/6.46.0 Chrome/118.0.5993.159 Electron/27.2.3 Safari/537.36

I've attached the relevant parts of the log. The log starts while signal is still running normally. Then after hibernating the computer and waking it up the next day, Signal stops receiving or sending messages.

debuglog-signal.txt

@obadz
Copy link

obadz commented Mar 28, 2024

To be double checked, but maybe this was fixed in v7.1.1 -> v7.2.1 ?

@jamiebuilds-signal
Copy link
Member

Awesome, I'll close this then and if people experience it again they can let us know

@obadz
Copy link

obadz commented Apr 3, 2024

Nope, bug's still there..

@obadz
Copy link

obadz commented Apr 6, 2024

@jamiebuilds-signal, can you please reopen? This bug isn't fixed.

@trevor-signal trevor-signal reopened this Apr 9, 2024
@trevor-signal
Copy link
Contributor

@obadz would you be willing to try the beta version to see if that helps?

@obadz
Copy link

obadz commented Apr 18, 2024

Hi @trevor-signal, I tried 7.4.0-beta.2 and it's not any better.

@fnevgeny
Copy link

fnevgeny commented May 13, 2024

I am not adding anything new; just to note this annoying bug has been with me for years. Each day, after the over-the-night suspension, I routinely begin my session by killing Signal and restarting it. Currently Ubuntu 22.04. While on another (office, never hybernating) computer with the same OS, it never happens.

@trevor-signal
Copy link
Contributor

@fnevgeny are you using light-locker as noted above?

@fnevgeny
Copy link

No, just manually selecting "Power off->Suspend" (which I suppose does something like systemctl suspend -i).

@trevor-signal
Copy link
Contributor

@fnevgeny can you share debug logs after this happens? And when you resume, does the app show that it's in a disconnected state? Do any messages arrive? Can any messages be sent? Thanks!

@fnevgeny
Copy link

No, there is no indication that it's in a disconnected state. I can neither send (there is a single circle, rotating forever, see below) nor receive new messages.
gkrellShoot_05-15-24_220410

Attaching the logs. In fact, this time, Signal survived over three nights. But the last suspend was fatal; the logs starting at 2024-05-15T06:45:02.048Z are from the limbo state.
debuglog2.txt.gz

@fnevgeny
Copy link

BTW, in this "limbo" state, File->Quit doesn't really quit the application, it only closes the GUI. So running the app again says

making app single instance
quitting; we are the second instance

and the GUI reappears (but again, it can neither send nor receive messages).

So I have to really kill the process.

@trevor-signal
Copy link
Contributor

BTW, in this "limbo" state, File->Quit doesn't really quit the application, it only closes the GUI. So running the app again says

making app single instance
quitting; we are the second instance

and the GUI reappears (but again, it can neither send nor receive messages).

So I have to really kill the process.

Thanks, @fnevgeny , this info is useful. From the logs it looks like one of our worker threads is not responding after resume. We'll continue to investigate.

@tonyarkles
Copy link

I am experiencing this as well with Debian 12.5 and Signal Desktop. The machine is never suspended but I am using Xfce and lock my screen when I'm away from the computer. I'm going to be away from home for a few days but am happy to help debug this issue when I get back.

@fnevgeny
Copy link

Not sure about the OP or other people affected, but for me, at least one reason that reliably causes this "limbo" state is when I apt-get update the system and there is a new version of signal-desktop - while the app is running. That is, overwriting the app files while it's running. I guess sometimes it happens automatically if an update is marked as a security fix, in which case Ubuntu by default applies the updates.

@bastschonet
Copy link

Still not working.
Debian 12.7, DE XFCE 4.18
Signal 7.31.0

@apiziali
Copy link
Author

As the author of the original bug report on September 1, 2022, I am following up because I recently updated my Linux workstation. After upgrading to Ubuntu 24.04 LTS and installing the latest Signal Desktop (currently 7.36.0), it now remains synchronized with my other Signal device, a Samsung Galaxy A21 phone running Android 12. Also, I should note that the Signal Desktop instance of a second user on the same Ubuntu 24.04 workstation also sees no issues. These two users are typically logged in simultaneously, using Switch User to change desktop sessions.

@fnevgeny
Copy link

Well, I did the 24.04 upgrade a month ago, and if anything has changed, it's the problem has become more severe - now, it happens every suspend.
@apiziali, did you actually upgrade or make a clean 24.04 install? In my case, it was the former.

@apiziali
Copy link
Author

@fnevgeny , I used a clean 24.04 install because I've had poor experiences with using "apt upgrade" to migrate from an older Ubuntu version to a newer one.

@nigiord
Copy link

nigiord commented Dec 16, 2024

Just to be sure, is there everyone here experiencing this issue not using light-locker?

We have multiple instances in the thread of people reporting a link with light-locker.

  • Bug often reported on Xfce (which uses light-locker by default through xflock4) (here
  • The problem has been reported as "solved" when switching from light-locker to xscreensaver (here)
  • A user reported a potential explanation here for a potential explanation (basically, light-locker works differently from other screenlocker and really lock everything in the user session, this could somehow poorly interact with the signal-desktop app).

Below is a new bug report from the information I got from the thread. If something does not match your experience, feel free to comment below.

Bug Description

When locking the computer for several minutes (either by suspending or manually locking), Signal Desktop becomes unresponsive upon unlocking. The behavior is as follows:
1. Signal Desktop freezes, showing old messages without updating to the latest ones.
2. Attempting to send a message results in it getting stuck with the sending icon spinning indefinitely. The message is never sent during this state.
3. Signal does not display any connectivity warnings (e.g., no yellow banner indicating loss of connection).
4. Quitting Signal does not work immediately. The application hangs and only closes after a timeout of approximately one minute, or if the process is manually killed.

Once Signal Desktop is restarted:
• Messages sent during the “frozen” state are delivered immediately but appear out of order in the chat history (displayed before new messages).

Possible Cause

This issue may be related to how light-locker interacts with Signal Desktop during lock/unlock events. If this is indeed the case, it may be a niche problem, which could explain why it hasn’t received much attention.

Suggested Fix

Signal Desktop should be able to detect this “frozen” state (e.g., when the application loses proper connectivity during a lock/suspend event) and reset itself automatically to restore normal functionality.

@obadz
Copy link

obadz commented Dec 16, 2024

After upgrading to Ubuntu 24.04 LTS and installing the latest Signal Desktop (currently 7.36.0), it now remains synchronized with my other Signal device

I've upgraded to 7.36 on NixOS 25.11 (cherry picking NixOS/nixpkgs#364691) and I'm still experiencing the issue, so it's likely that what fixed yours is a change in different sleep settings in your fresh Ubuntu install vs what you had before rather than the new version of signal.

@apiziali
Copy link
Author

apiziali commented Dec 16, 2024

@nigiord Correct. I am NOT using Light Locker. Rather, I am using the stock Gnome Display Manager's built-in screen lock. That screen lock does, by default, lock the screen on suspend. Although Signal works fine with this setting, I am turning it off because it is of no use in my environment.

@fnevgeny
Copy link

When locking the computer for several minutes (either by suspending or manually locking), Signal Desktop becomes unresponsive upon unlocking.

For me, locking never triggers the bug, only suspending.

Attempting to send a message results in it getting stuck

I wouldn't call it "getting stuck" in the normal meaning. The GUI remains fully responsive; it just (apparently) loses network connectivity - or perhaps it loses connectivity to another thread in charge for the actual functionality.

Quitting Signal does not work immediately. The application hangs and only closes after a timeout of approximately one minute

It's different here. The GUI disappears immediately, but the process still runs in the background. Running the app again (without killing the process) pops the GUI instantly but in the same "frozen" state.

@apiziali
Copy link
Author

apiziali commented Jan 6, 2025

With about a month into using Signal Desktop (now version 7.36.1), I can report that it still loses synchronization with Signal Android after a number of suspend/resumes, interspersed with switching back and forth between two users. I just received a chat from a friend on the phone, but it was never reported on the desktop. Furthermore, when Signal Desktop gets into this state, a File > Quit does nothing, other than close the open window and remove the "Show" option from the tray icon menu.

This is the debug log I created:

https://debuglogs.org/desktop/7.36.1/b7309b2a6e39aff6fcd0939c0ef216c7dd07334354a90822742064c64ac3b2dd.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests