Signal-desktop: Linux: Signal shouldn't crash when the package is updated out from under it

Created on 14 Feb 2019  路  15Comments  路  Source: signalapp/Signal-Desktop

Signal shouldn't crash when the package is updated

The problem

Currently when Signal is updated and you are using the argument --use-tray-icon the in memory running instace of Signal will crash with the following error:

Unhandled Error TypeError: Error processing argument at index 0, conversion failure from /opt/Signal/resources/app.asar/images/alert/256/1.png at Tray.tray.updateIcon.unreadCount [as updateIcon] (/opt/Signal/resources/app.asar/app/tray_icon.js:83:12) at EventEmitter.ipc.on (/opt/Signal/resources/app.asar/main.js:858:10) at EventEmitter.emit (events.js:182:13) at WebContents.<anonymous> (/opt/Signal/resources/electron.asar/browser/api/web-contents.js:284:13) at WebContents.emit (events.js:182:13)

Many applications on Linux Distros are updated and still run in memory fine even though their files have changed, Signal should not be an exception to this.

Signal also behaves quite badly in this instance and has to be sent a SIGTERM to shut down the process.

Solutions

  • Put a check in the code to see if the conversion fails and handle it gracefully
  • Have the Signal Application realise when it's files have changed and prompt the person to restart it while halting all other operations
  • Abandon using the package manager and implement an updating method in the Signal Application itself (Similar to the update system for Firefox when you get it from Mozilla)
  • Consult with upstream (I presume Electron) and see if this bug is a result of something on their end

Related bug reports

This bug stems from discussion on issue #3117

Should Be Fixed

All 15 comments

To be clear, this happens when Signal is updated, you're using the tray icon, and you receive a new message. The crash is in the code to update the unread count on the icon; we hand the underlying Electron API an icon that no longer exists.

I think I hit this as well. Fedora 29

Unhandled Error
TypeError: Error processing argument at index 0, conversion failure from /opt/Signal/resources/app.asar/images/alert/256/1.png
    at Tray.tray.updateIcon.unreadCount [as updateIcon] (/opt/Signal/resources/app.asar/app/tray_icon.js:83:12)
    at EventEmitter.ipc.on (/opt/Signal/resources/app.asar/main.js:865:10)
    at EventEmitter.emit (events.js:182:13)
    at WebContents.<anonymous> (/opt/Signal/resources/electron.asar/browser/api/web-contents.js:284:13)
    at WebContents.emit (events.js:182:13)

@hehnope are you using --use-tray-icon?

@hehnope might be differences between the Fedora package and the Debian package then, or something else shrug.

v1.22 has a change to check for the existence of the tray icon before we hand it to the system. Adding a 'should be fixed' tag to this issue now...

@scottnonnenberg-signal awesome thanks for the change.

Since I got an update last night and I didn't wake up to a crashed signal this can probably be closed now.

Seems I spoke too soon Signal updated overnight via unattended-upgrade and I came back to:

````
Unhandled Error

TypeError: Error processing argument at index 0, conversion failure from [REDACTED]/app.asar/images/alert/256/1.png
at Tray.tray.updateIcon.unreadCount [as updateIcon] ([REDACTED]/app.asar/app/tray_icon.js:95:10)
at EventEmitter.ipc.on ([REDACTED]/app.asar/main.js:867:10)
at EventEmitter.emit (events.js:182:13)
at WebContents. ([REDACTED]/electron.asar/browser/api/web-contents.js:346:13)
at WebContents.emit (events.js:182:13)
````

and

````
Unhandled Promise Rejection

Error: Object has been destroyed
at WebContents.send ([REDACTED]/electron.asar/browser/api/web-contents.js:112:15)
at EventEmitter.ipcMain.on ([REDACTED]/app.asar/app/sql_channel.js:39:20)
````

update: now i'm getting the Unhandled Promise Rejection dialogs again, this is what it says in the terminal:

{"name":"log","hostname":"fur","pid":2665,"level":30,"msg":"sql channel error with call saveUnprocessed: Error: Object has been destroyed\n    at WebContents.send ([REDACTED]/electron.asar/browser/api/web-contents.js:112:15)\n    at EventEmitter.ipcMain.on ([REDACTED]/app.asar/app/sql_channel.js:33:20)","time":"2019-04-29T22:42:29.468Z","v":0}
{"name":"log","hostname":"fur","pid":2665,"level":50,"msg":"Unhandled Promise Rejection: Error: Object has been destroyed\n    at WebContents.send ([REDACTED]/electron.asar/browser/api/web-contents.js:112:15)\n    at EventEmitter.ipcMain.on ([REDACTED]/app.asar/app/sql_channel.js:39:20)","time":"2019-04-29T22:42:29.469Z","v":0}
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

over and over and over again. what's happening?

update: I restarted and ran signal-desktop from the terminal, and after a lot of CPU and RAM hogging, arrived at this error:

<--- Last few GCs --->

[2723:0xa5f9d905000]  2735106 ms: Scavenge 1828.2 (2098.3) -> 1816.8 (2100.3) MB, 32.3 / 0.5 ms  (average mu = 0.209, current mu = 0.135) allocation failure 
[2723:0xa5f9d905000]  2736544 ms: Mark-sweep 1830.1 (2100.3) -> 1814.8 (2098.8) MB, 1263.7 / 4.1 ms  (average mu = 0.264, current mu = 0.317) allocation failure scavenge might not succeed
[2723:0xa5f9d905000]  2736779 ms: Scavenge 1827.9 (2098.8) -> 1817.3 (2101.3) MB, 28.4 / 0.5 ms  (average mu = 0.264, current mu = 0.317) allocation failure 


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 0x5599e4b34cce]
Security context: 0x3efecdbc7411 <String[7]: file://>
    1: fromCharCode [0x3efecdb9baf9](this=0x3efecdb9b9f1 <JSFunction String (sfi = 0x39e52f19a6e1)>,47,97,112,105,47,118,49,47,109,101,115,115,97,103,101)
    2: /* anonymous */ [0xbc4c80047a9] [file:///opt/Signal/resources/app.asar/js/libtextsecure.js:~32108] [pc=0x331e5c9ca72b](this=0x1ffd129a0949 <Element map = 0x95b31cbba39>,0x1e4a570c0701 <Byt...

![Screenshot from 2019-04-29 15-29-27](https://user-images.githubusercontent.com/1930655/56931182-0601dc00-6a94-11e9-8088-45bb0d2e5d9e.png)

original comment:
I'm having this too.  I use Signal Desktop every day, and I am presently running version 1.24.1

Linux Mint 18 Sarah
Linux fur 4.10.12-041012-generic #201704210512 SMP Fri Apr 21 09:14:40 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

![Screenshot from 2019-04-29 13-00-59](https://user-images.githubusercontent.com/1930655/56930129-93dbc800-6a90-11e9-980a-43084ab2754e.png)
![Screenshot from 2019-04-29 13-51-23](https://user-images.githubusercontent.com/1930655/56930130-93dbc800-6a90-11e9-9d15-07da5351312b.png)
![Screenshot from 2019-04-29 14-34-46](https://user-images.githubusercontent.com/1930655/56930131-94745e80-6a90-11e9-8567-a0daae9a3b17.png)

Unhandled Promise Rejection

Error: Object has been destroyed
    at WebContents.send ([REDACTED]/electron.asar/browser/api/web-contents.js:112:15)
    at EventEmitter.ipcMain.on ([REDACTED]/app.asar/app/sql_channel.js:39:20)

@jerkey If your issue is not related to apt updating Signal Desktop while it is running, please enter a new bug, following the bug template.

@jerkey If your issue is not related to apt updating Signal Desktop while it is running, please enter a new bug, following the bug template.

my issue was caused by apt updating Signal Desktop while it was running, and I documented the drama it caused, which was a lot. I had to get a new battery for my phone because in the process of Signal Desktop and Signal Android trying to sync to each other, there was a lot of CPU eating going on for days. In the process it exposed a lot of problems in Signal Desktop like unhandled exceptions which should be handled somehow, now that we know about them.

I still have thousands (?) of messages from Note to Self with invalid data screwing up my database. All because of the bug in this issue
Screenshot from 2019-05-01 23-02-39

@jerkey Please provide a debug log (or reach out to [email protected]) and we can get started investigating your situation. The key reason I wanted a separate bug for you is that debug log, and because it looks like you're running into more than just apt-related issues.

@scottnonnenberg when I picked "debug log" signal-desktop crashed with the following (i run in terminal now so i can see the output)

<--- Last few GCs --->

[14067:0xb45aa2cb000] 50340529 ms: Mark-sweep 1998.0 (2015.7) -> 1998.0 (2012.7) MB, 474.9 / 0.0 ms  (average mu = 0.513, current mu = 0.000) last resort GC in old space requested
[14067:0xb45aa2cb000] 50340939 ms: Mark-sweep 1998.0 (2012.7) -> 1998.0 (2012.2) MB, 408.6 / 0.0 ms  (average mu = 0.361, current mu = 0.001) last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x236056ad10f1 <JSObject>
    0: builtin exit frame: parse(this=0x236056ac9cc9 <Object map = 0x13af7ab05b11>,0x32c570093b19 <String[289]: {"name":"log","hostname":"fur","pid":31746,"level":30,"msg":"Update notifications: {\"shouldClearNotifications\":false,\"shouldPlayNotificationSound\":false,\"shouldShowNotifications\":true,\"type\":\"ok\",\"isNotificationGroupingSupported\":true}","time":"2019-04-30T12:00:15.847Z","v"...

Illegal instruction

reopened signal-desktop and tried "Debug log" again:

<--- Last few GCs --->

[7522:0x2c9e03e66000]    88245 ms: Mark-sweep 1997.8 (2014.2) -> 1997.8 (2013.2) MB, 420.9 / 0.0 ms  (average mu = 0.536, current mu = 0.000) last resort GC in old space requested
[7522:0x2c9e03e66000]    88640 ms: Mark-sweep 1997.8 (2013.2) -> 1997.8 (2013.2) MB, 395.6 / 0.0 ms  (average mu = 0.362, current mu = 0.000) last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x32fcb727eeb1 <JSObject>
    0: builtin exit frame: parse(this=0x32fcb7277b89 <Object map = 0x98d62d05b11>,0x3cb8de250db1 <String[443]: {"name":"log","hostname":"fur","pid":31746,"level":50,"msg":"queueEnvelope error handling envelope +[REDACTED]699.1 1556623006224 (56eb08d2-a4a5-4f7a-a2d5-2e7189b3b6ec) : Error: Over 2000 messages into the future!\n    at SessionCipher.fillMessageKeys (file://[REDACTED]/app.asar/js/libt...

Illegal instruction

Ya got some really serious problems there! Let's do this - zip up ~/.config/Signal/logs and send it to [email protected].

It looks like they're basically throwing on another thread - another tick of the event loop.

I think at this point we need to go to the Electron maintainers and tell them to fix their API. We put a try/catch around it, which is the best we can do without amending our global crash handler to special-case this error.

Was this page helpful?
0 / 5 - 0 ratings