flathub / org.electronjs.Electron2.BaseApp

7 stars 16 forks source link

Crashes, potentially related to GSettings schemas #58

Closed threema-danilo closed 7 months ago

threema-danilo commented 7 months ago

The Threema Desktop 2.0 application Flatpak currently crashes on Linux when trying to save a file to the filesystem:

(ThreemaDesktop:3): GLib-GIO-ERROR **: 13:30:13.015: No GSettings schemas are installed on the system
[0321/133013.015690:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Operation not permitted (1)
/app/bin/run.sh: line 15:     3 Trace/breakpoint trap   (core dumped) zypak-wrapper.sh ./ThreemaDesktop "$@"

I'm not 100% sure, but to me it looks like the "ptrace: Operation not permitted" line is a red herring, and the actual error is "No GSettings schemas are installed on the system".

This reminded me that – when starting the application – the following warning is logged as well:

(ThreemaDesktop:3): GLib-GIO-CRITICAL **: 14:05:27.049: g_settings_schema_source_lookup: assertion 'source != NULL' failed

This log has existed for a long time, but has never impacted the application in a negative way, so we ignored it so far.

The problem has only started to appear in the last few days or weeks (without us changing the application), so I assume it has to do with updated Flatpak base layers.


I'm not really familiar how these GSettings schemas work. However, from some online search, it seems that there are schema files at /usr/share/glib-2.0/schemas/*.gschema.xml, and that these need to be compiled with glib-compile-schemas. When When these schemas are compiled, this results in a gschemas.compiled file. I cannot find that file in our Flatpak OS filesystem.

According to https://stackoverflow.com/a/56317158/284318:

You should not ship a compiled gschemas.compiled cache as part of your app — instead, you should just ship your *.gschema.xml file. gschemas.compiled is intended as a system-wide cache of all the *.gschema.xml files in (by default) /usr/share/glib-2.0/schemas, and should be regenerated by the package manager after an app installs a new schema.

Based on that information, I would consider the Flatpak base images to be the "package manager". I as app developer cannot regenerate the schemas, because:

Running: glib-compile-schemas /usr/share/glib-2.0/schemas/
Warning: Schema “org.gnome.system.locale” has path “/system/locale/”.  Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy” has path “/system/proxy/”.  Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.http” has path “/system/proxy/http/”.  Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.https” has path “/system/proxy/https/”.  Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.ftp” has path “/system/proxy/ftp/”.  Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Warning: Schema “org.gnome.system.proxy.socks” has path “/system/proxy/socks/”.  Paths starting with “/apps/”, “/desktop/” or “/system/” are deprecated.
Failed to create file “/usr/share/glib-2.0/schemas/gschemas.compiled.7NFRK2”: Read-only file system

I am not sure whether this is something that should be done by the base image, or by the runtime. However, I think someone, somewhere in the Flatpak ecosystem needs to generate these compiled schemas.

Erick555 commented 7 months ago

When When these schemas are compiled, this results in a gschemas.compiled file. I cannot find that file in our Flatpak OS filesystem.

Where are you looking for them?

$ flatpak run org.freedesktop.Platform//23.08
[📦 org.freedesktop.Platform ~]$ ls -al /usr/share/glib-2.0/schemas/gschemas.compiled
-rw-r--r-- 6 nfsnobody nfsnobody 39965 Jan  1  1970 /usr/share/glib-2.0/schemas/gschemas.compiled

So the problem may be that your app is unable to find something that clearly exist.

For ptrace you may add --allow=devel permission (I guess this is electron internal crash reporter).

BTW: why do you call zypak-wrapper.sh instead of zypak-wrapper?

Erick555 commented 7 months ago

There is regression in freedesktop-sdk 22.08 which makes gschemas.compiled lost. 23.08 is unaffected.

threema-danilo commented 7 months ago

Where are you looking for them?

I used $ find / -name "gschemas.compiled" inside the application container and got no results. I also looked in the /usr/share/glib-2.0/schemas/ directory and did not see gschemas.compiled.

There is regression in freedesktop-sdk 22.08 which makes gschemas.compiled lost. 23.08 is unaffected.

Oh, great, this is probably the reason! We are still on 22.08, good occasion to update. Thanks for digging out the link.

bbhtt commented 7 months ago

should be fixed now

threema-danilo commented 7 months ago

Confirmed, thanks!