FS#69980 - [gtk3] [signal-desktop] 1.40.1-1 breaks after recent gtk3 with tracker3 enabled

Attached to Project: Community Packages
Opened by Alphonso Piotrowicz (Al.Piotrowicz) - Sunday, 14 March 2021, 00:19 GMT
Last edited by kpcyrd (kpcyrd) - Friday, 19 November 2021, 12:32 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Levente Polyak (anthraxx)
kpcyrd (kpcyrd)
Santiago Torres (sangy)
Architecture x86_64
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 27
Private No

Details

Description:
After recent gtk3-1:3.24.27-3, signal-desktop app breaks with:

{"name":"log","hostname":"rebro","pid":128854,"level":30,"msg":"app ready","time":"2021-03-13T21:00:42.852Z","v":0}
{"name":"log","hostname":"rebro","pid":128854,"level":30,"msg":"starting version 1.40.1","time":"2021-03-13T21:00:42.852Z","v":0}
{"name":"log","hostname":"rebro","pid":128854,"level":30,"msg":"media access status undefined undefined","time":"2021-03-13T21:00:42.852Z","v":0}
{"name":"log","hostname":"rebro","pid":128854,"level":30,"msg":"migrateDatabase: Migration without cipher change failed","time":"2021-03-13T21:00:42.878Z","v":0}
{"name":"log","hostname":"rebro","pid":128854,"level":30,"msg":"Database startup error: Error: SQLITE_NOTADB: file is not a database","time":"2021-03-13T21:00:42.881Z","v":0}
{"name":"log","hostname":"rebro","pid":128854,"level":30,"msg":"sql.initialize was unsuccessful; returning early","time":"2021-03-13T21:01:08.271Z","v":0}


Additional info:
* package version(s) signal-desktop 1.40.1-1 ; gtk3 1:3.24.27-3
* config and/or log files etc.
* link to upstream bug report, if any https://github.com/signalapp/Signal-Desktop/issues/4513

Steps to reproduce: Update to gtk3-1:3.24.27-3 and run signal-desktop app.
This task depends upon

Closed by  kpcyrd (kpcyrd)
Friday, 19 November 2021, 12:32 GMT
Reason for closing:  Fixed
Additional comments about closing:  5.24.0-1
Comment by Bruno Pagani (ArchangeGabriel) - Sunday, 14 March 2021, 17:55 GMT
It also breaks mailspring, and element encrypted search. So I guess this is electron-related?
Comment by kpcyrd (kpcyrd) - Sunday, 14 March 2021, 23:48 GMT
Filed this as an gtk issue: https://bugs.archlinux.org/task/69990
Comment by Bjoern Franke (bjo) - Monday, 15 March 2021, 14:21 GMT
Installing sqlcipher and running LD_PRELOAD=/usr/lib/libsqlcipher.so signal-desktop seem to work around this issue (Thanks to Andreas Bosch on arch-general). Maybe the dependency sqlcipher and a modified desktop-file with LD_PRELOAD could be added to the signal-desktop package? It seems the whole "gtk3/tracker breaks sqlcipher"-thing is a bit bigger.
Comment by Geert Hendrickx (ghen) - Monday, 15 March 2021, 14:51 GMT
Why is Signal-desktop using a statically linked sqlcipher library in the first place?
The package is already patching away a statically linked openssl that caused issues.
Comment by Jan Alexander Steffens (heftig) - Monday, 15 March 2021, 15:17 GMT
The library in question is actually a dynamic library located at

/usr/lib/signal-desktop/resources/app.asar.unpacked/node_modules/@journeyapps/sqlcipher/lib/binding/napi-v6-linux-x64/node_sqlite3.node

The use of node-pre-gyp suggests this might be a precompiled library, but on inspection it refers to GCC 10.2.0 and GLibC 2.33 so it's probably compiled by us.
Comment by Hans Mueller (Skingrende) - Wednesday, 17 March 2021, 08:46 GMT
Downgrading to gtk3-1:3.24.27-3 worked for me as a short-term workaround. Signal starts without data loss.

Issue of the signal-desktop project: https://github.com/signalapp/Signal-Desktop/issues/4513
Comment by Cedric Wehrum (Scindix) - Friday, 19 March 2021, 02:18 GMT
Unfortunately Bjoern Franke's method didn't work for me.
But downgrading to gtk3-1:3.24.27-3 as suggested by Hans Mueller did the trick.
Comment by Bjoern Franke (bjo) - Friday, 19 March 2021, 10:39 GMT
It seems that in your case your database is unencrypted now, as kpcyrd also pointed out here: https://github.com/signalapp/Signal-Desktop/issues/4513#issuecomment-801147849
Comment by Maximilian Böhm (holalu) - Saturday, 03 April 2021, 11:30 GMT
Is this really not fixed yet? I don’t have this problem anymore on my system without downgrading gtk3.
Comment by Jan Alexander Steffens (heftig) - Saturday, 03 April 2021, 13:18 GMT
https://bugs.archlinux.org/task/69990 was "fixed" by reverting the Tracker 3 support, but that is only temporary. This needs to be fixed in Signal or it's just going to break again when Tracker 3 support is re-enabled.
Comment by kpcyrd (kpcyrd) - Saturday, 03 April 2021, 14:52 GMT Comment by Karl Cronburg (karl) - Friday, 13 August 2021, 17:49 GMT
I've installed the latest signal-desktop (5.13.0-1) and it breaks for me in the same way:

Unhandled Promise Rejection: Error: SqliteError: file is not a database
at Database.pragma (/usr/lib/signal-desktop/resources/app.asar.unpacked/ts/sql/mainWorker.bundle.js:648:31)
at getUserVersion (/usr/lib/signal-desktop/resources/app.asar.unpacked/ts/sql/mainWorker.bundle.js:23949:15)
at migrateSchemaVersion (/usr/lib/signal-desktop/resources/app.asar.unpacked/ts/sql/mainWorker.bundle.js:23969:25)
at openAndMigrateDatabase (/usr/lib/signal-desktop/resources/app.asar.unpacked/ts/sql/mainWorker.bundle.js:24001:5)
at openAndSetUpSQLCipher (/usr/lib/signal-desktop/resources/app.asar.unpacked/ts/sql/mainWorker.bundle.js:24017:16)
at Object.initialize (/usr/lib/signal-desktop/resources/app.asar.unpacked/ts/sql/mainWorker.bundle.js:25563:14)
at MessagePort.<anonymous> (/usr/lib/signal-desktop/resources/app.asar.unpacked/ts/sql/mainWorker.bundle.js:28224:36)
at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:354:41)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)
at Worker.<anonymous> (/usr/lib/signal-desktop/resources/app.asar/ts/sql/main.js:33:29)
at Worker.emit (events.js:315:20)
at MessagePort.<anonymous> (internal/worker.js:207:53)
at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:354:41)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)

Packages: signal-desktop-5.13.0-1, gtk3-1:3.24.30-2

Steps to reproduce:
* Install the latest packages of Arch with signal-desktop installed, and run it without any data located in '~/.config/Signal'.

I tried downgrading gtk3 to various old versions I had lying around, and I tried running signal-desktop with LD_PRELOAD=/usr/lib/libsqlcipher.so, but neither fixed the problem.
Comment by Jan Alexander Steffens (heftig) - Friday, 13 August 2021, 18:22 GMT
Have you considered that your database might be legitimately broken?

That is, restarting signal with the database wiped creates a new SQLCipher database and not an unencrypted one.
Comment by Karl Cronburg (karl) - Friday, 13 August 2021, 18:31 GMT
I recursively deleted the entire ~/.config/Signal directory. I have no database. Signal attempts to create a new one at initialization (during the openAndSetUpSQLCipher function), and then crashes when it subsequently attempts to migrate it later on during initialization. This is the file it creates and then immediately crashes on:

$ file ~/.config/Signal/sql/db.sqlite
$HOME/.config/Signal/sql/db.sqlite: data
Comment by Jan Alexander Steffens (heftig) - Friday, 13 August 2021, 19:56 GMT
Could you test if this is solved by signal-desktop 5.13.0-3?
Comment by Karl Cronburg (karl) - Friday, 13 August 2021, 21:18 GMT
That PKGBUILD didn't work for me, but I did find the following symbol lookup / undefined symbol error with strace on signal-desktop:

[pid 12657] 17:04:52 writev(2, [{iov_base="/bin/sh", iov_len=7}, {iov_base=":
", iov_len=2}, {iov_base="symbol lookup error", iov_len=19}, {iov_base=": ",
iov_len=2}, {iov_base="/usr/lib/signal-desktop/resource"..., iov_len=113},
{iov_base=": ", iov_len=2}, {iov_base="undefined symbol: _ZN2v86String1"...,
iov_len=81}, {iov_base="", iov_len=0}, {iov_base="", iov_len=0},
{iov_base="\n", iov_len=1}], 10/bin/sh: symbol lookup error:
/usr/lib/signal-desktop/resources/app.asar.unpacked/node_modules/better-sqlite3/build/Release/better_sqlite3.node:
undefined symbol:
_ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi

And I also see this line in the strace output as well, likely meaning the unencrypted version is being loaded when the better_sqlite3 version fails?:

[pid 12683] 17:04:56 openat(AT_FDCWD, "/usr/lib/libsqlite3.so.0", O_RDONLY|O_CLOEXEC <unfinished ...>
Comment by Karl Cronburg (karl) - Saturday, 14 August 2021, 21:19 GMT
Definitely not solved by 5.13.0-3. I just tested it in a clean Arch install / docker image here: https://github.com/cronburg/signal-desktop-docker

I get the same error compiling from source with the Github repo instructions, so I'll open an issue there soon.
Comment by kpcyrd (kpcyrd) - Friday, 19 November 2021, 12:32 GMT
We've carried a patch by heftig for a while that has now been fully upstreamed starting with 5.24.0-1

Loading...