GLib-GObject-WARNING


#1

I’m getting some odd warning in 18.04 and Pop!_OS when running a snap that I’ve built.

The snap works perfectly in Solus.

Here’s what I’m seeing:

(java:10170): GLib-GObject-WARNING **: cannot register existing type 'GtkIMContext'

(java:10170): GLib-GObject-WARNING **: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(java:10170): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(java:10170): GLib-GObject-CRITICAL **: g_type_register_dynamic: assertion 'parent_type > 0' failed

Is this a known issue with a simple fix? I’m not sure where to start with this so if you have any ideas where I should start looking, I’d much appreciate it.


#2

This is related with input method frameworks like IBus.


#3

Okay, I saw that in my online searches. Is there any reason this would affect *buntu and not Solus as far as snapd is concerned?


#4

I doubt this has something to do with the incompatibility between the Gtk versions used on host and the snap.


#5

You may try disconnecting the desktop-legacy interface if it is previously connected, note that this will make input method unusable in the snap.


#6

No go. It’s doing the same thing. I’ll try different interfaces and see what happens.


#7

You may also try dropping all Gtk immodules from the prime directory:

$ find prime/ -name 'im-*.so'
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-multipress.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-inuktitut.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-cyrillic-translit.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-xim.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-cedilla.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ti-et.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-viqr.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-thai.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-am-et.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ti-er.so
prime/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ipa.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-multipress.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-inuktitut.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-cyrillic-translit.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-xim.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-cedilla.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-ti-et.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-viqr.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-broadway.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-wayland.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-thai.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-am-et.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-ti-er.so
prime/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-ipa.so

#8

Found this: Can't use input method in snap apps

Specifically adding ibus-gtk3 to staging.

Trying it now.


#9

No joy…

Still getting the same errors.


#10

Nada…

Here’s the snap version on Solus at present:

james@bumblebee ~ $ snap --version
snap    2.36.1
snapd   2.36.1
series  16
solus   3.9999
kernel  4.19.8-104.current

I removed each interface, one at a time until the snap wouldn’t launch at all. Nothing changed as far as the error I’ve been getting consistently.


#11

If the application doesn’t crash after the error, perhaps look in/proc/$pid/maps to check what libraries have been mapped into the application. A command like the following might help:

cat /proc/$pid/maps | awk '{print $6}' | sort | uniq

GTK registers classes at runtime in a global namespace, so my hunch is that you’ve some how got two copies of GTK mapped into your application (the warning is about the GtkIMContext class itself, rather than a subclass that would belong to one of the input method modules).

If that is the case, can you share the paths of the two libraries? That should help in narrowing down what’s going on.


#12

Users are now reporting that the snap is working as expected. I reverted the yaml back to the original. I’m not sure what was occurring when it was throwing the error but it appears to be gone for now.

Closing.

SIKE. :expressionless:


#13

Okay,

Here’s what I found (Thanks @jamesh)

[heap]
/home/james/snap/mc-installer/159/appdata/.minecraft/launcher.jar
/home/james/snap/mc-installer/159/Minecraft.jar
/home/james/snap/mc-installer/common/.cache/fontconfig/04aabc0a78ac019cf9454389977116d2-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/0bd3dc0958fa2205aaaa8ebb13e2872b-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/0c9eb80ebd1c36541ebe2852d3bb0c49-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/0d8c3b2ac0904cb8a57a757ad11a4a08-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/14a5e22175779b556eaa434240950366-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/16c2fda60d1b4b719f4b3d06fd951d25-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/1ac9eb803944fde146138c791f5cc56a-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/2171a34dccabdb6bcbbc728186263178-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/22368d551a680bfe5a62c02760edf4ea-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/2300eef321c393bfd76478a5c0e95b23-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/3047814df9a2f067bd2d96a2b9c36e5a-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/370e5b74bf5dafc30834de68e24a87a4-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/3f589640d34b7dc9042c8d453f7c8b9c-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/3f7329c5293ffd510edef78f73874cfd-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/49f0de54bdd920fe4f0dfd4cbac43e6b-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/4b2eda6bb976bda485cb2176619421d5-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/4d9c95eba1cb85bbcf2878543262124a-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/4f3e3037c9980c83b53a9351efadef62-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/550f3886151c940c12a5ed35f6a00586-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/551ecf3b0e8b0bca0f25c0944f561853-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/564b2e68ac9bc4e36a6f7f6d6125ec1c-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/56cf4f4769d0f4abc89a4895d7bd3ae1-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/589f83ef4c36d296ce6e1c846f468f08-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/660208299946a285a940457d1287da33-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/674d1711f2d1d2a09646eb0bdcadee49-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/6afa1bb216ce958c1589e297e8008489-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/6b2c5944714ca7831b25bed9e85cb5c8-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/767a8244fc0220cfb567a839d0392e0b-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/7aea6fce339a0890dd172c653a1e4f57-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/7cb26f2fb68b5c60781ad239c07f25b9-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/85e0a52ce643a7ba2ae53e5d6949cead-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/9b89f8e3dae116d678bbf48e5f21f69b-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/9d2451b1fd30e5bffe8383fd27c35478-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/a48eab177a16e4f3713381162db2f3e9-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/aec30016f93e1b46d1a973dce0d74068-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/b47c4e1ecd0709278f4910c18777a504-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/b872e6e592da6075ffa4ab0a1fcc0c75-le64.cache-6
/home/james/snap/mc-installer/common/.cache/fontconfig/b9d506c9ac06c20b433354fa67a72993-le64.cache-6

#14

Here’s the very latest snapcraft.yaml

name: mc-installer
version: 1.2.2
summary: Minecraft Downloader and Installer
description: |
    A port of the Minecraft-NSG installer snap. Omits the Oracle version of Java and just runs with openjdk. Skips the dialog and just downloads the .jar and runs the installer. 
grade: stable
confinement: strict

apps:
  mc-installer:
    command: desktop-launch $SNAP/launch
    plugs:
      - x11
      - network
      - unity7
      - opengl
      - pulseaudio
      - wayland
      - desktop
      - desktop-legacy
      - browser-support
      - home

parts:
  launcher:
    plugin: dump
    source: scripts
    after: [desktop-gtk3]
  desktop-gtk3:
    stage:
      - -usr/sbin/update-icon-caches
  game:
    plugin: nil
    build-packages:
      - ca-certificates
      - ca-certificates-java
      - openjdk-8-jre-headless
    stage-packages:
      - libgl1-mesa-dri
      - libpulse0
      - yad
      - wget
      - libxext6
      - libxrender1
      - libxtst6
      - libxi6
      - libswt-gtk-3-java
      - libwebkit2gtk-3.0-25
      - x11-xserver-utils
      - python3-gi
      - python3-gi-cairo
      - python3-cairo
      - gir1.2-gtk-3.0
      - openjdk-8-jre-headless
      #- ibus-gtk3
      #- libglib2.0-dev
      #- libglibd-2.0-dev

Again, this is not happening across every install of Ubuntu. As stated, it’s working as intended on Solus, Ubuntu Mate, Suse, etc.


#15

I’m surprised there are no libraries listed there. It is normal for fontconfig cache files to be memory mapped, as is Java JAR files.

The main reason for checking what was mapped was to see if there were any obviously incompatible libraries loaded into the process.


#16

It’s really weird…and I’m having a hard time finding why it would be an issue.

It’s doing this on vanilla Ubuntu 18.04 and Pop! 18.04

No one is reporting issues with any other distro.


#17

I’m wondering if this is an issue with “desktop-gtk3” helper?

I’m getting the same errors with Unity.


#18

YEP!! It was (in this case) the GTK desktop helper.

This new version of the yaml works:

name: mc-installer
version: 1.2.6
summary: Minecraft Downloader and Installer
description: |
    A port of the Minecraft-NSG installer snap. Omits the Oracle version of Java and just runs with openjdk. Skips the dialog and just downloads the .jar and runs the installer. 
grade: stable
confinement: strict

apps:
  mc-installer:
    command: desktop-launch $SNAP/launch
    plugs:
      - x11
      - network
      - unity7
      - opengl
      - pulseaudio
      - wayland
      - desktop
      - desktop-legacy
      - browser-support
      - home

parts:
  launcher:
    plugin: dump
    source: scripts
    after: [desktop-qt5]
  #desktop-gtk3:
    #stage:
      #- -usr/sbin/update-icon-caches
  game:
    plugin: nil
    build-packages:
      - ca-certificates
      - ca-certificates-java
      - openjdk-8-jre-headless
    stage-packages:
      - libgl1-mesa-dri
      - libpulse0
      - yad
      - wget
      - libxext6
      - libxrender1
      - libxtst6
      - libxi6
      - libswt-gtk-3-java
      - libwebkit2gtk-3.0-25
      - x11-xserver-utils
      - python3-gi
      - python3-gi-cairo
      - python3-cairo
      - gir1.2-gtk-3.0
      - openjdk-8-jre-headless