mirage icon indicating copy to clipboard operation
mirage copied to clipboard

QML Cache breaks Mirage between upgrades

Open colemickens opened this issue 5 years ago • 7 comments

Description

I upgraded my Nix build of Mirage to 0.5.2 and it stopped working. Many hours later I deleted my ~/.cache/mirage and it started working.

I was getting an error from a QML file about "Account" not being a type in hte AccountBar.qml file, even after you'd refactored it to ~AccountBar~ AccountDelegate, so I guessed that the QML was getting copied to disk at some point and then cleared the cache.

Ideally Mirage would version the QML cache or clear it more aggressively or something?

Your environment

  • OS or distribution (e.g. Arch Linux, macOS 10.15, Windows 7...) NixOS
  • Architecture (e.g. x86 64bit) x86_64-linux
  • For Linux users: your desktop environment or window manager (e.g. GNOME 3.34 Wayland, i3 4.17, etc) Sway
  • How did you install Mirage? (e.g. manual build, distribution repository, AppImage, Flatpak...): Nix
  • For manual installations: your Qt version 5.13
  • For manual installations: your Python version 3.8

Steps to reproduce

  1. Run version 0.5.1
  2. Upgrade
  3. Run version 0.5.2

Expected behavior

It should work.

Actual behavior

  1. Originally it actually segfaulted over and over (I can't remember what fixed that)

  2. Eventually it would load a black/grey window and then fail with messages in the console about failing to load QML:

> $(nix-build ~/code/nixpkgs/pulls/mirage -A mirage-im)/bin/mirage
~ 09:38:16 | Got library name:  "/nix/store/3z4vm3gsf9zvsj9im9xmx8pmdia8cjqq-pyotherside-1.5.9/lib/qt-5.12.7/qml/io/thp/pyotherside/libpyothersideplugin.so"
~ 09:38:16 | Using Wayland-EGL
~ 09:38:17 | Using the 'xdg-shell' shell integration
! 09:38:18 | qrc:/src/gui/UI.qml:123:5: Type MainPane unavailable
! 09:38:18 | qrc:/src/gui/MainPane/MainPane.qml:43:9: Type AccountBar unavailable
! 09:38:18 | qrc:/src/gui/MainPane/AccountBar.qml:41:19: Account is not a type

colemickens avatar Jul 01 '20 16:07 colemickens

I've never had problems with the cache and can switch between different releases at any time, I feel like this is a problem with the Nix package.

I can install the Nix package manager on my distro, what are the commands needed to test your package?

mirukana avatar Jul 03 '20 16:07 mirukana

I'm preparing instructions right now. As I downgraded, I hit the issue again, but the opposite way:

~ 09:31:48 | Got library name:  "/nix/store/3z4vm3gsf9zvsj9im9xmx8pmdia8cjqq-pyotherside-1.5.9/lib/qt-5.12.7/qml/io/thp/pyotherside/libpyothersideplugin.so"
~ 09:31:48 | Using Wayland-EGL
~ 09:31:48 | Using the 'xdg-shell' shell integration
! 09:31:49 | qrc:/src/gui/UI.qml:123:5: Type MainPane unavailable
! 09:31:49 | qrc:/src/gui/MainPane/MainPane.qml:39:9: Type TopBar unavailable
! 09:31:49 | qrc:/src/gui/MainPane/TopBar.qml:15:9: Type HButton unavailable
! 09:31:49 | qrc:/src/gui/Base/HButton.qml:31:17: Type HButtonBackground unavailable
! 09:31:49 | qrc:/src/gui/Base/HButtonBackground.qml:39:5: HBottomFocusLine is not a type

colemickens avatar Jul 03 '20 16:07 colemickens

nixpkgs (031b25600aa6a46107b54f46d61f9b2cbbe0e7be) (mirage 0.5.1) : https://github.com/colemickens/nixpkgs/blob/031b25600aa6a46107b54f46d61f9b2cbbe0e7be/pkgs/applications/networking/instant-messengers/mirage/default.nix

nixpkgs (6fe2ad2f822f9cb6a2b7f520693f67d961b27620) (mirage 0.5.2) : https://github.com/colemickens/nixpkgs/blob/6fe2ad2f822f9cb6a2b7f520693f67d961b27620/pkgs/applications/networking/instant-messengers/mirage/default.nix

Test with cached builds:

rev051="031b25600aa6a46107b54f46d61f9b2cbbe0e7be"
rev052="6fe2ad2f822f9cb6a2b7f520693f67d961b27620"

mirage051="$(nix-build --option "extra-binary-caches" "https://cache.nixos.org https://colemickens.cachix.org https://nixpkgs-wayland.cachix.org" --option "trusted-public-keys" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= colemickens.cachix.org-1:bNrJ6FfMREB4bd4BOjEN85Niu8VcPdQe4F4KxVsb/I4= nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" "https://github.com/colemickens/nixpkgs/archive/$rev051.tar.gz" -A mirage-im)"

mirage052="$(nix-build --option "extra-binary-caches" "https://cache.nixos.org https://colemickens.cachix.org https://nixpkgs-wayland.cachix.org" --option "trusted-public-keys" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= colemickens.cachix.org-1:bNrJ6FfMREB4bd4BOjEN85Niu8VcPdQe4F4KxVsb/I4= nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=" "https://github.com/colemickens/nixpkgs/archive/$rev052.tar.gz" -A mirage-im)"

$ rm -rf ~/.cache
$ mirage051/bin/mirage # works
$ mirage052/bin/mirage # doesnt work
! 09:43:16 | qrc:/src/gui/UI.qml:123:5: Type MainPane unavailable
! 09:43:16 | qrc:/src/gui/MainPane/MainPane.qml:43:9: Type AccountBar unavailable
! 09:43:16 | qrc:/src/gui/MainPane/AccountBar.qml:41:19: Account is not a type

$ rm -rf ~/.cache
$ mirage-052/bin/mirage # works

$ mirage-051/bin/mirage # doesn't work

! 09:44:14 | qrc:/src/gui/UI.qml:123:5: Type MainPane unavailable
! 09:44:14 | qrc:/src/gui/MainPane/MainPane.qml:39:9: Type TopBar unavailable
! 09:44:14 | qrc:/src/gui/MainPane/TopBar.qml:15:9: Type HButton unavailable
! 09:44:14 | qrc:/src/gui/Base/HButton.qml:31:17: Type HButtonBackground unavailable
! 09:44:14 | qrc:/src/gui/Base/HButtonBackground.qml:39:5: HBottomFocusLine is not a type

$ rm -rf ~/.cache
$ mirage-051/bin/mirage # works

colemickens avatar Jul 03 '20 16:07 colemickens

i have this same issue with flatpak

theotheroracle avatar Jul 11 '20 23:07 theotheroracle

I suspect this is related to the fact that all files in nix store have the creation date of 0 (the UNIX timestamp for 1.1.1970). I don't know anything about QML cache, but if I were to write it, I would compare the timestamp of the binary with the one of the cache

vojta001 avatar Sep 30 '20 08:09 vojta001

Building using the Qt Quick Compiler could solve this problem for good, since it won't need to maintain a cache on the filesystem. If I understand the Known Issues correctly, the only downside is that the application must be recompiled when Qt is updated, but I guess that's not an issue for distro packages?

You can test this by compiling with make clean; qmake CONFIG+=qtquickcompiler; make.

mirukana avatar Nov 13 '20 20:11 mirukana

I'm having this despite not upgrading on postmarketOS on my PinePhone. Strangely it does not occur when I run it in a VM, even an aarch64 QEMU one. It also does not occur in my Alpine Linux VM. Removing ~/.cache does not help. I'm not quite sure what to make of this. I will try the qtquickcompiler workaround tomorrow.

Full log: mirage.log

Newbytee avatar Nov 21 '20 21:11 Newbytee