Open dreamcat4 opened 6 years ago
Seems to be QT related? However it only started happening once I tried logging in with Firefox.
$ megasync --debug | tee -a megasynclog.txt
qt5ct: using qt5ct plugin
08:17:19 (debug): QT_SCALE_FACTOR = 1
08:17:19 (debug): xrdb dpi read = 0
08:17:19 (debug): QT Debug: D-Bus system tray: yes
08:17:19 (debug): QT Context: qt5ct 2
08:17:19 (warn): QT Warning: QSystemTrayIcon::setVisible: No Icon set
08:17:19 (warn): QT Context: default 2
08:17:19 (debug): cURL version: 7.49.1 (net.cpp:82)
08:17:19 (debug): SSL version: OpenSSL/1.1.0g (net.cpp:87)
08:17:19 (debug): libz version: 1.2.11 (net.cpp:111)
08:17:19 (debug): IPv6 enabled: 1 (net.cpp:130)
08:17:19 (debug): Initializing OpenSSL locking callbacks (net.cpp:154)
08:17:19 (debug): DNS servers: 127.0.3.1 (net.cpp:332)
08:17:19 (debug): MediaInfo version: 1712 (mediafileattribute.cpp:71)
08:17:19 (debug): User-Agent: MEGAsync/3.7.1.0 (ubuntu 18.04/Linux 4.18.12-041812-lowlatency x86_64) MegaClient/3.4.1 (megaclient.cpp:1046)
08:17:19 (debug): Cryptopp version: 564 (megaclient.cpp:1047)
08:17:19 (debug): cURL version: 7.49.1 (net.cpp:82)
08:17:19 (debug): SSL version: OpenSSL/1.1.0g (net.cpp:87)
08:17:19 (debug): libz version: 1.2.11 (net.cpp:111)
08:17:19 (debug): IPv6 enabled: 1 (net.cpp:130)
08:17:19 (debug): Initializing OpenSSL locking callbacks (net.cpp:154)
08:17:19 (debug): DNS servers: 127.0.3.1 (net.cpp:332)
08:17:19 (debug): MediaInfo version: 1712 (mediafileattribute.cpp:71)
08:17:19 (debug): User-Agent: MEGAsync/3.7.1.0 (ubuntu 18.04/Linux 4.18.12-041812-lowlatency x86_64) MegaClient/3.4.1 (megaclient.cpp:1046)
08:17:19 (debug): Cryptopp version: 564 (megaclient.cpp:1047)
08:17:19 (info): MEGAsync is starting. Version string: 3.7.1 Version code: 3701.0 User-Agent: MEGAsync/3.7.1.0 (ubuntu 18.04/Linux 4.18.12-041812-lowlatency x86_64) MegaClient/3.4.1
08:17:19 (debug): Unknown language code: en_gb (megaapi_impl.cpp:9271)
08:17:19 (debug): Unknown language code: en_g (megaapi_impl.cpp:9271)
08:17:19 (debug): Unknown language code: en_ (megaapi_impl.cpp:9271)
08:17:19 (debug): Unknown language code: en_gb (megaapi_impl.cpp:9271)
08:17:19 (debug): Unknown language code: en_g (megaapi_impl.cpp:9271)
08:17:19 (debug): Unknown language code: en_ (megaapi_impl.cpp:9271)
08:17:19 (info): Request (SET_MAX_CONNECTIONS) starting (megaapi_impl.cpp:13291)
08:17:19 (info): Request (SET_MAX_CONNECTIONS) finished (megaapi_impl.cpp:13323)
08:17:19 (info): Request (SET_MAX_CONNECTIONS) starting (megaapi_impl.cpp:13291)
08:17:19 (info): Request (SET_MAX_CONNECTIONS) finished (megaapi_impl.cpp:13323)
08:17:19 (info): Request (USE_HTTPS_ONLY) starting (megaapi_impl.cpp:13291)
08:17:19 (info): Request (USE_HTTPS_ONLY) finished (megaapi_impl.cpp:13323)
08:17:19 (info): Checking pending crash repors
08:17:19 (info): New crash file: /home/id/.local/share/data/Mega Limited/MEGAsync/crashDumps/36b3c060-893d-0305-717fd681-231edb16.dmp Hash: 15fda286ef20d2a9b22470e726e048c7
It was QT_SCALE_FACTOR=1
in my ENV vars. This is what is causing the crash / segfault.
The variable was set for [a different QT program on my system], albert
launcher.
$ export QT_SCALE_FACTOR=1
θ99° [id:~/.local/share/data/Mega Limited] $ megasync
qt5ct: using qt5ct plugin
qt5ct: using qt5ct plugin
[id:~/.local/share/data/Mega Limited] 139 $
when I unset QT_SCALE_FACTOR
, and run megasync
from terminal. Then I can open up file dialogs without triggering the segfault / crash.
Thanks for the thorough report @dreamcat4 . Based on your dumps I'd say Qt is failing to render some particular widget. I don't think it'll be related to having logged in in firefox
.
We do calculate QT_SCALE_FACTOR value for high resolution screens in case it is not defined. Apparently having it set to 1 causes QT to segfault. We'll try to reproduce that and see if we can overcome that anyhow. A couple of question just in case: what's your screen resolution? can you provide us a log (just the first ~30 lines ) of megasync with QT_SCALE_FACTOR unset in your case?
Thanks again for reporting that.
By the way, for convenience in the meantime you can add modify megasync startup by editing Exec command in ~/.config/autostart/megasync.desktop, to unset QT_SCALE_FACTOR there:
Exec=bash -c "unset QT_SCALE_FACTOR && megasync"
@polmr ah yes - I forgot to mention: my screen resolution is standard 1080p, 2x displays side by side (both 1080p).
Something else strange: after removing QT_SCALE_FACTOR=1
from my environment, it still shows up in the debug log output. Not sure why that is.
$ megasync --debug
10:44:18 (debug): QT_SCALE_FACTOR = 1
10:44:18 (debug): xrdb dpi read = 96
10:44:18 (debug): QT Debug: D-Bus system tray: yes
10:44:18 (debug): QT Context: qt5ct 2
10:44:18 (warn): QT Warning: QSystemTrayIcon::setVisible: No Icon set
10:44:18 (warn): QT Context: default 2
10:44:18 (debug): cURL version: 7.49.1 (net.cpp:82)
10:44:18 (debug): SSL version: OpenSSL/1.1.0g (net.cpp:87)
10:44:18 (debug): libz version: 1.2.11 (net.cpp:111)
10:44:18 (debug): IPv6 enabled: 1 (net.cpp:130)
10:44:18 (debug): Initializing OpenSSL locking callbacks (net.cpp:154)
10:44:18 (debug): DNS servers: 127.0.3.1 (net.cpp:332)
10:44:18 (debug): MediaInfo version: 1712 (mediafileattribute.cpp:71)
10:44:18 (debug): User-Agent: MEGAsync/3.7.1.0 (ubuntu 18.04/Linux 4.18.12-041812-lowlatency x86_64) MegaClient/3.4.1 (megaclient.cpp:1046)
10:44:18 (debug): Cryptopp version: 564 (megaclient.cpp:1047)
10:44:18 (debug): cURL version: 7.49.1 (net.cpp:82)
10:44:18 (debug): SSL version: OpenSSL/1.1.0g (net.cpp:87)
10:44:18 (debug): libz version: 1.2.11 (net.cpp:111)
10:44:18 (debug): IPv6 enabled: 1 (net.cpp:130)
10:44:18 (debug): Initializing OpenSSL locking callbacks (net.cpp:154)
10:44:18 (debug): DNS servers: 127.0.3.1 (net.cpp:332)
10:44:18 (debug): MediaInfo version: 1712 (mediafileattribute.cpp:71)
10:44:18 (debug): User-Agent: MEGAsync/3.7.1.0 (ubuntu 18.04/Linux 4.18.12-041812-lowlatency x86_64) MegaClient/3.4.1 (megaclient.cpp:1046)
10:44:18 (debug): Cryptopp version: 564 (megaclient.cpp:1047)
10:44:18 (info): MEGAsync is starting. Version string: 3.7.1 Version code: 3701.0 User-Agent: MEGAsync/3.7.1.0 (ubuntu 18.04/Linux 4.18.12-041812-lowlatency x86_64) MegaClient/3.4.1
10:44:18 (info): Request (SET_MAX_CONNECTIONS) starting (megaapi_impl.cpp:13291)
10:44:18 (info): Request (SET_MAX_CONNECTIONS) finished (megaapi_impl.cpp:13323)
10:44:18 (info): Request (SET_MAX_CONNECTIONS) starting (megaapi_impl.cpp:13291)
10:44:18 (info): Request (SET_MAX_CONNECTIONS) finished (megaapi_impl.cpp:13323)
10:44:18 (info): Request (USE_HTTPS_ONLY) starting (megaapi_impl.cpp:13291)
10:44:18 (info): Request (USE_HTTPS_ONLY) finished (megaapi_impl.cpp:13323)
10:44:18 (info): Request (SET_PROXY) starting (megaapi_impl.cpp:13291)
10:44:18 (info): Request (SET_PROXY) finished (megaapi_impl.cpp:13323)
10:44:18 (info): Request (RETRY_PENDING_CONNECTIONS) starting (megaapi_impl.cpp:13291)
10:44:18 (debug): Reinitializing the network layer (net.cpp:669)
10:44:18 (info): Request (SET_PROXY) starting (megaapi_impl.cpp:13291)
10:44:18 (info): Request (SET_PROXY) finished (megaapi_impl.cpp:13323)
10:44:18 (info): Request (RETRY_PENDING_CONNECTIONS) starting (megaapi_impl.cpp:13291)
10:44:18 (debug): Reinitializing the network layer (net.cpp:669)
10:44:18 (debug): DNS servers: 127.0.3.1 (net.cpp:332)
10:44:18 (info): Request (RETRY_PENDING_CONNECTIONS) finished (megaapi_impl.cpp:13323)
10:44:18 (debug): Excluded path: /home/id/Mega/Desktop/MEGAsync.log (megaapi_impl.cpp:7133)
10:44:18 (debug): DNS servers: 127.0.3.1 (net.cpp:332)
10:44:18 (info): Request (LOGIN) starting (megaapi_impl.cpp:13291)
10:44:18 (info): Request (RETRY_PENDING_CONNECTIONS) finished (megaapi_impl.cpp:13323)
10:44:18 (debug): Reinitializing the network layer (net.cpp:669)
10:44:18 (info): Local HTTP server started
10:44:18 (debug): DNS servers: 127.0.3.1 (net.cpp:332)
10:44:18 (debug): Using an upgraded DB (sqlite.cpp:110)
10:44:18 (info): Request (GET_LOCAL_SSL_CERT) starting (megaapi_impl.cpp:13291)
10:44:18 (debug): Resolving IPv4 address for g.api.mega.co.nz (net.cpp:1772)
Yet definately, that was removed (commented out) from my file /etc/profiles.d/qt5ct.sh
$ env | grep -i qt_scale
[id:~] 1 $
This was changed, then I rebooted my machine. And mega works now.
$ cat /etc/profile.d/qt5ct.sh
#!/bin/sh
export QT_QPA_PLATFORMTHEME="qt5ct"
# interferes with the launching of qt5ct control panel
unset QT_STYLE_OVERRIDE
# there is some kind of a scaling problem for .svg tray icons in budgie
# this affects appindicator tray icons - for albert launcher
# disabled here - this causes segfault to occur in megasync
# instead launch albert with `QT_SCALE_FACTOR=1 albert`
# export QT_SCALE_FACTOR=1
[id:~] $
And this variable alone, was what stopped the SEGFAULTs from happening. Very strange that it would still show up in the log like that, yet start working again.
megasync defines QT_SCALE_FACTOR in case it is not previously defined based on calculations depending on your screen size. That's why you see it in the log. What's puzzling is that it is defined to 1 (same as your export!), and there barely is any difference between launching it with QT_SCALE_FACTOR unset or set to 1
(perhaps it takes an insignificant extra time to load). We'll investigate that further, thanks for all the info ;-)
Hi again. What have you been doing towards fixing this QT related bug? May I make a small suggestion:
This bug only occurs when adding a **local sync folder, by clicking on the icon next to the emtpy textbox. And that is when it is supposed to open the file dialog. But crashes instead of displaying anything.
Well this has been happening again to me today, and unfortunately the unsetting of QT_SCALE_FACTOR env variable is not working anymore.
So my suggestion is: just make that test box free text editable
Then it crashes, due to some QT bug. Stacktrace:
https://gist.github.com/dreamcat4/e42dc45c9634b97cdf09cc8f857dbf98
Just please - give me an alternative way to enter the local sync folder path. With copy-paste (ctrl+v). Or Free text entry by the keyboard. Then you can fix this bug on your own schedule without drastically affecting user(s) in the meantime. Thank you.
This issue seems to be similar to https://github.com/meganz/MEGAsync/issues/108
Thing is that you claimed downloading from the url mega.nz/sync was a version that would fix the issue for that other guy. Yet there are many versions up there for different distros. The one for my distro installed as follows. It seems I already had the latest version it was the same....
$ sudo gdebi -n megasync-xUbuntu_18.04_amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done
(Reading database ... 532797 files and directories currently installed.)
Preparing to unpack megasync-xUbuntu_18.04_amd64.deb ...
Unpacking megasync (3.7.1+3.1) over (3.7.1+3.1) ...
Setting up megasync (3.7.1+3.1) ...
fs.inotify.max_user_watches = 524288
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for bamfdaemon (0.5.3+18.04.20180207.2-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Still segfaults in the same place, when adding a local sync folder. And without any local sync folders, it cannot sync any of my files! Please help.
Tried wiping all local settings folder for the 2nd time today. And I can login again just fine now. Both in the megasync app, and on chromium browser. But that really doesn't get me anywhere with restoring my sync folders. Because I cannot add them back again into the settings / active syncs tab! No use whatsoever.
Still crashes. Same place.
https://gist.github.com/dreamcat4/6b66064d6055ac378e9d7850dd2932a1
Compiled the app from source, according to instructions in the README.md file. Bug is gone. So what does this mean? The official downloads of the sync client on the mega landing page mega.nz/sync are not including the necessary fix(es).
Hi @dreamcat4 , Thanks again for the time you've taken reporting that. I'm afraid the code you have compiled is pretty much the same as the one offered by the official packages. Perhaps it's been compiled with different version of the dependencies and that somehow fixes Qt bug. Would you care to tell us what versions did you use (the output of this should do):
dpkg -l libzen-dev libmediainfo-dev debhelper qtbase5-dev qt5-qmake qt4-linguist-tools libqt5dbus5 libqt5svg5-dev libcrypto++-dev libraw-dev libc-ares-dev libssl-dev libsqlite3-dev zlib1g-dev wget dh-autoreconf cdbs unzip libtool-bin pkg-config qt5-default qttools5-dev-tools libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libmediainfo-dev
Ah ok then... actually that makes a lot of sense. One other smaller point, forgot to mention this earlier was that despite my locally compiled version not crashing on the critical file dialog window (when adding a local sync folder). It still nevertheless will sometimes crash (segfaults) immediately upon startup. Which is a slightly different type of error behaviour. Which it seems another different user was also saying at least once in past comment on other similar or related QT crashing issues.
Anyhow here is the output of that cmd you asked for:
[id:~] $ dpkg -l libzen-dev libmediainfo-dev debhelper qtbase5-dev qt5-qmake qt4-linguist-tools libqt5dbus5 libqt5svg5-dev libcrypto++-dev libraw-dev libc-ares-dev libssl-dev libsqlite3-dev zlib1g-dev wget dh-autoreconf cdbs unzip libtool-bin pkg-config qt5-default qttools5-dev-tools libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libmediainfo-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================================-=========================-=========================-======================================================================================
ii cdbs 0.4.156ubuntu4 all common build system for Debian packages
ii debhelper 11.1.6ubuntu2 all helper programs for debian/rules
ii dh-autoreconf 17 all debhelper add-on to call autoreconf and clean up after the build
ii libavcodec-dev:amd64 7:3.4.4-0ubuntu0.18.04.1 amd64 FFmpeg library with de/encoders for audio/video codecs - development files
ii libavformat-dev:amd64 7:3.4.4-0ubuntu0.18.04.1 amd64 FFmpeg library with (de)muxers for multimedia containers - development files
ii libavutil-dev:amd64 7:3.4.4-0ubuntu0.18.04.1 amd64 FFmpeg library with functions for simplifying programming - development files
ii libc-ares-dev:amd64 1.14.0-1 amd64 asynchronous name resolver - development files
ii libcrypto++-dev 5.6.4-8 amd64 General purpose cryptographic library - C++ development
ii libmediainfo-dev 17.12-1build1 amd64 library reading metadata from media files -- headers
ii libqt5dbus5:amd64 5.9.5+dfsg-0ubuntu1 amd64 Qt 5 D-Bus module
ii libqt5svg5-dev:amd64 5.9.5-0ubuntu1 amd64 Qt 5 SVG module development files
ii libraw-dev:amd64 0.18.8-1ubuntu0.1 amd64 raw image decoder library (development files)
ii libsqlite3-dev:amd64 3.22.0-1 amd64 SQLite 3 development files
ii libssl-dev:amd64 1.1.0g-2ubuntu4.1 amd64 Secure Sockets Layer toolkit - development files
ii libswscale-dev:amd64 7:3.4.4-0ubuntu0.18.04.1 amd64 FFmpeg library for image scaling and various conversions - development files
ii libtool-bin 2.4.6-2 amd64 Generic library support script (libtool binary)
ii libzen-dev 0.4.37-1 amd64 ZenLib C++ utility library -- development files
ii pkg-config 0.29.1-0ubuntu2 amd64 manage compile and link flags for libraries
ii qt4-linguist-tools 4:4.8.7+dfsg-7ubuntu1 amd64 Qt 4 Linguist tools
ii qt5-default:amd64 5.9.5+dfsg-0ubuntu1 amd64 Qt 5 development defaults package
ii qt5-qmake:amd64 5.9.5+dfsg-0ubuntu1 amd64 Qt 5 qmake Makefile generator tool
ii qtbase5-dev:amd64 5.9.5+dfsg-0ubuntu1 amd64 Qt 5 base development files
ii qttools5-dev-tools 5.9.5-0ubuntu1 amd64 Qt 5 development tools
ii unzip 6.0-21ubuntu1 amd64 De-archiver for .zip files
ii wget 1.19.4-1ubuntu2.1 amd64 retrieves files from the web
ii zlib1g-dev:amd64 1:1.2.11.dfsg-0ubuntu2 amd64 compression library - development
[id:~] $
In addition to that, will be recompiling locally again from scratch, and gist the full build log from start to finish. In case there is anything else in there you might need to search for / compare against.
And here is the full build log:
https://gist.github.com/dreamcat4/20615e931c2427ef3423bb906ed26021
Thanks @dreamcat4 I'm afraid you are building with the same versions of dependencies. That's frustrating. Some user just mentioned having a crash only when he's got some binded folder mounted. I don't see any relation, but perhaps there's some special circumstance in the folder selection dialog (e.g: different favorites in the left panel). We still can't reproduce it. We will probably follow your suggestion allowing to type the path, so as to circumvent crashing apps.
Indeed, that is frustrating. Well after your last comment about the bind mount I went back to my fstab, ran mount
command, and checked for any bind mounts. Unfortunately I don't seem to have any at the moment. Although I used to have one in my home folder. But that was ages ago and I have since deleted my MEGA settings folder many times by now.
What I do have in my home folder is some ordinary symlinks. Although I really have far too many symlinks as important hidden folders. So I was unable to try getting rid of them all. Which would have caused other issues / breakages for me.
The only other thing I could think of is to run both versions of the app with --debug
enabled. So you can compare the 2 logs for any changes and see if anything clicks. Ah QT framework... why do you have so many as 10,000 open bugs now? And what are the alternatives for a modern gui application?
@polmr
Ah-ha! That last matter has revealed what the difference actually was: And indeed it was not the 2 versions of the mega client. As you said so yourself they are pretty similar.
Here is how I found the issue:
megasync --debug
flag. No useful information being printing in there. Oh well never mind! Because:Why? Because I launched them both via the terminal shell. Rather than only the self-compiled versions. So stupid not to have tried this before.
The situation is that:
megasync
is launched from my logged in terminal window, the QT widgets works.megasync
is launched as a Startup / login item. It crashes.megasync
is launched via albert program launcher. It crashes.So there is probably something in my local ~/.profile
that is making QT things work. Or visa-vera, there is something missing from my global environment. For example in the /etc/profile.d/
folder. Or similar places like that.
I shall investigate further and report back.
@dreamcat4 That sound really promising and some deep investigation. We really appreciate that! I've tried to reproduce it taking that into account in a Linux Mint 19. Still unable. Please, let us know if you find some conclusion and thanks again: Now we know some way for preventing the crash, at least in your case: launching from terminal.
Hey man... theres definately something going on here. And I hope to be able to get to the bottom of this... perhaps with a little extra help from you guys!
I'm about half way through investigating this now.
Well these were my first investigations....
Doing unset of all QT_*
env vars. The ones that directly relate to QT frameworks. And it all still works correctly. Then unset of all GTK_*
env vars. It still works just fine.
Continued removing seemingly random / unrelated env vars by binary search until....
Finally I removed almost all of my environment variables. Except for some really basic ones like DISPLAY
and HOME
which seemed essential in order to launch the megasync
gui program! Including getting rig of my entire PATH
variable (empty). And everything else from A-z... Still works, not bug. It will still open that file dialog box.
So it does not after all, appear to be a missing env var. And the bug still crashes when MEGASync gui app is launched via either albert launcher, or as a gnome Startup Login Item... its pretty confounding!
Perhaps I need to take an env
as a startup login item. However the issue there I was encountering was that the command field chokes on >
there, in order to pipe the stdout to a file, without invoking a login shell etc. Which is not what a direct invokation of the application would see.
But at it is somewhat reproducible now. With / without the bug. I am continuing to look into this:
What I have finally noticed is that,
When I double click on the file /usr/share/applications/megasync.desktop
from a Nautilus file manager window. Then NAUTILUS is invoking megasync gui app through the .desktop
file. Which might be also a similar way how it's being invoked both through alfred launcher, and also from the startup applications entry.
However 2 new findings here:
1) when i double click the same .desktop
file from the alternative File manager progam names nemo
. Which is something competitor to nautilus, not by gnome (its from cinnamon? i think?). Then it doesnt crash / segfault. Which is what was happening when launched via nautilus file manager.
2) The other thing is that for some reason your QT build environment is marking the plain / bare megasync
executable file as a shared lib. Rather than a proper executable. This means it cannot be directly double clicked / launched from neither Nautilus nor Nemo file managers. The executable located in /usr/bin/megasync
. There is a further explanation about it here:
Not sure if that is related or not. Because I cannot check without knowing how to recompile megasync
properly to appear to the system / OS an .exe rather than a lib.
In the meantime, I have created a very short C program (env-to-file https://gist.github.com/dreamcat4/21a7ec6792968342ab31c5dbbdbe8e89), that can dump the raw environment from the login items. However again, it might not matter if this problem is instead somehow related to Nautilus or the contents of the megasync.desktop
file.
I will also compate this megasync.desktop
content to other QT applications on my system. To see if anything else can be fiddled with.
@polmr Heh, might have found something. These commands were executed in my Tilix terminal window:
# crashed. QT widgets bug, when opening the file dialog box
$ SHLVL=0 megasync
qt5ct: using qt5ct plugin
qt5ct: using qt5ct plugin
qt5ct: using qt5ct plugin
1& [id:~] 139 $ killall -9 megasync
# this works, does not crash
$ SHLVL=1 megasync
# this also works, does not crash
$ unset SHLVL
$ megasync
qt5ct: using qt5ct plugin
qt5ct: using qt5ct plugin
libpng error: Not a PNG file
libpng error: Not a PNG file
For some reason, nautilus / gnome / or invokations through gnome startup items, or through the .desktop
file. They all set that specific environment variable SHLVL=0
. Then it crashes.
Otherwise it doesnt crash. Maybe see if you can reproduce? Have googled for "QT5 SHLVL crash". But didn't find anything. It's rather weird and I can't say I really understand why this might have anything to do with all this. So hopefully you can reproduce yourselves over there in your own linux environment.
BTW, still also believe you need to fix the ELF header thing in the executable. So that the megasync
program executable does not appear to the OS as a .so
shared lib. But that might not be related to this specific bug. It just happened to be noticed during these investigations.
@polmr Heh, might have found something. These commands were executed in my Tilix terminal window:
# crashed. QT widgets bug, when opening the file dialog box
$ SHLVL=0 megasync
qt5ct: using qt5ct plugin
qt5ct: using qt5ct plugin
qt5ct: using qt5ct plugin
1& [id:~] 139 $ killall -9 megasync
# this works, does not crash
$ SHLVL=1 megasync
# this also works, does not crash
$ unset SHLVL
$ megasync
qt5ct: using qt5ct plugin
qt5ct: using qt5ct plugin
libpng error: Not a PNG file
libpng error: Not a PNG file
For some reason, nautilus / gnome / or invokations through gnome startup items, or through the .desktop
file. They all set that specific environment variable SHLVL=0
. Then it crashes.
Otherwise it doesnt crash. Maybe see if you can reproduce? Have googled for "QT5 SHLVL crash". But didn't find anything. It's rather weird and I can't say I really understand why this might have anything to do with all this. So hopefully you can reproduce yourselves over there in your own linux environment.
BTW, still also believe you need to fix the ELF header thing in the executable. So that the megasync
program executable does not appear to the OS as a .so
shared lib. But that might not be related to this specific bug. It just happened to be noticed during these investigations.
Now, I Have been trying to modify the .desktop
launcher file, to change the value of SHLVL
.
[EDIT] FIXED
https://developer.gnome.org/desktop-entry-spec/#exec-variables
What I have changed the .desktop file to is this:
[Desktop Entry]
Type=Application
Version=1.0
GenericName=File Synchronizer
Name=MEGASync
Comment=Easy automated syncing between your computers and your MEGA cloud drive.
#TryExec=env -u SHLVL megasync
Exec=env -u SHLVL megasync
Icon=mega
Terminal=false
Categories=Network;System;
StartupNotify=false
#X-GNOME-Autostart-Delay=60
It is also essential to REMOVE the following line:
#TryExec=env -u SHLVL megasync
must be either deleted or commented out. Because otherwise the .desktop
file cannot be parsed and is considered invalid / wont launch / wont execute.
The variable SHLVL is not mentioned or referenced anywhere in your megasync source code. So it must be a QT bug, something in the QT libs... which is where you cannot search the QT bug tracker for "SHLVL". Because there are so many QT bugs, and people dumping logs of their env vars into unrelated bug reports all the time.
Comment updated. To be clear, doing this has now fixed my issue:
[Desktop Entry]
#TryExec=megasync
Exec=env -u SHLVL megasync
Explanation? No idea. It remains rather ambiguous. But I suppose it's no less logical than any of the many other 'rather strange' QT bugs. I would suggest open an new bug in the QT issue tracker. But with so many other open bugs I'm certain they are completely overwhelmed and therefore very unlikely to be seen by any qt project members. Perhaps more could be gained by grepping the entire QT codebase for SHLVL
. That might turn up something though I am really out of time myself at this point to make any further contributions...
I just have to recommend in the meantime you edit / ammend your .desktop
file with the suggested fix, and also fix your ELF headers. Thank you for showing a renewed interest in fixing this problem.
Finally, for anyone else encountering this issue on current versions of megasync
, then until its been fixed properly here are some fix commands can be copy-pasted into a terminal window:
# megasync - Fix QT crashing bug
cd /usr/share/applications
sudo sed -i -e "s|^TryExec.*|#TryExec=env -u SHLVL megasync|g" megasync.desktop
sudo sed -i -e "s|^Exec=.*|Exec=env -u SHLVL megasync|g" megasync.desktop
sudo sed -i -e "s|^X-GNOME-Autostart-Delay.*|#X-GNOME-Autostart-Delay=60|g" megasync.desktop
# or
cp /usr/share/applications/megasync.desktop ~/.local/share/applications
cd ~/.local/share/applications
sed -i -e "s|^TryExec.*|#TryExec=env -u SHLVL megasync|g" megasync.desktop
sed -i -e "s|^Exec=.*|Exec=env -u SHLVL megasync|g" megasync.desktop
sed -i -e "s|^X-GNOME-Autostart-Delay.*|#X-GNOME-Autostart-Delay=60|g" megasync.desktop
# or
cp /usr/share/applications/megasync.desktop ~/.config/autostart
cd ~/.config/autostart
sed -i -e "s|^TryExec.*|#TryExec=env -u SHLVL megasync|g" megasync.desktop
sed -i -e "s|^Exec=.*|Exec=env -u SHLVL megasync|g" megasync.desktop
sed -i -e "s|^X-GNOME-Autostart-Delay.*|#X-GNOME-Autostart-Delay=60|g" megasync.desktop
@dreamcat4 fantastic analysis man! Could you do one last favor? Can you try this executable: megasync_noshslvl.zip SHA256sum:
9e738d77e4e191a4ad32424e68b99e41f196fd9aff955eaf1022c3e79a7086e4 megasync_3.7.1+8.1_noshlvl_amd64.deb
I still can't reproduce the issue forcing SHLVL environment variable.
In that executable, your proposed fix is included within the executable (to avoid meddling with the .desktop file): undefining SHLVL at startup. See https://github.com/meganz/MEGAsync/commit/0852f7e664b3fdcd415140895e66d5fef674a615. If you prefer, you can compile it yourself checking unsetshlvl
branch.
We will fix the ELF header.
Hey there again. Yep. Just deleted all of my modified .desktop
files first. Then installed the testing .deb
package which you very kindly provided. Thanks for that!
As expected, indeed it works in my local environment.
But there was also a special edge case left remaining. Which was not covered by your fix. Which was something that I had reported on initially. The edge case is as follows:
When I am using my favorite program launcher, the linux program named 'Albert'. Well that also happens to be a QT5 program itself too. Unfortunately this other QT program (the parent process), it actually needs a specific environment variable in order for function correctly. Which is the:
QT_SCALE_FACTOR=1
Which is to avoid some other / different kind of gui bug @ https://github.com/albertlauncher/albert/issues/700
Anyhow, that other program, the 'albert launcher' is chiefly what am using to launch MEGASync with, any time it needs to be [re]launched manually. Well then, as the parent process, albert passes on the QT_SCALE_FACTOR=1
environment variable to be inherited by megasync too. Then megasync freaks out about it in that same spot there, opening up that specific file dialogue box.
So since yout fix only deals with the SHLVL
variable, and not the QT_SCALE_FACTOR
variable.... Then the bug still occurs, under those special conditions.
Ideally I would request that you also unset that variable too. Because unfortunately, I don't seem to have any alternative method of externally un-setting / disabling what environment variables which albert is passing into it. Because it's not an option which is exposed within the albert program.
In all other regards, I tested your proposed fix for the SHLVL
variable, and it works great. Including with the unmodified (default) megasync.desktop
file. And also with the automatic login item, etc. Everything else works now.
And I must say... a better / more elegant way of fixing this issue. Thanks again!
Ey @dreamcat4 , I'm afraid we use QT_SCALE_FACTOR for ... well, for the actual intent of QT_SCALE_FACTOR: scale the UI in cases where the screen is too big. We let the users set specific QT_SCALE_FACTOR values in case our scaling calculated value does not fit their needs. Unsetting it will break such functionality. For albert launcher
may I suggest you to create a launcher yourself that executes some script that unsets QT_SCALE_FACTOR and then launches MEGAsync ...
No problem.
ey @dreamcat4 we finally got to reproduce a segfault: having in qt5ct set Appearance -> Style -> Windows makes it crash when opening a folder selector dialog (adding sync). based on that, we have discovered that the less troublesome solution is to unset QT_QPA_PLATFORMTHEME variable. Modifying the .desktop files (/usr/share/applications/megasync.desktop && ~/.config/autostart/megasync.desktop) with:
#TryExec=megasync
Exec=bash -c "unset QT_QPA_PLATFORMTHEME && megasync"
should do with the official megasync 3.7.1 package from https://mega.nz/sync. @dreamcat4 let us know if you try that solution please, so that we can confirm that's enough in every case
That is great news - I am glad to hear it. Will be trying that solution in the coming days and get back to you. Thanks again!
@polmr OK, results of my testing was:
QT_QPA_PLATFORMTHEME
, then means that the value of QT_SCALE_FACTOR is also ignoredHowever a side effect is that the tray icon is now more basic (black and white), rather than the color red logo.
So perhaps the implication of that is:
If you unset the variable within the initialization routine of your compiled program, then the change cannot be turned off, so to speak.
Unless there is some other way of getting the Red color logo back. A method which does not require setting the QT_QPA_PLATFORMTHEME=qt5ct
.
So IDK how you intend to deal with that situation when you implement this solution. You are entirely free to use your own discretion here and go whichever way you like with it. Just that is the information gathered from my testing! Kind regards.
ey @dreamcat4 , the black&white tray icons are used for ubuntu-mono-dark
themes (and those that inherit from that). When unsetting QT_QPA_PLATFORMTHEME, qt5ct no longer governs how the look&feel of MEGAsync is. Hence it will use the icon based on your system configuration. My default Mint19 has Mint-Y icon theme and it is not using the dark tray icons. Maybe your case is different. You can always replace the icons from:
/usr/share/icons/hicolor/scalable/status/megawarning.svg
/usr/share/icons/hicolor/scalable/status/megasynching.svg
/usr/share/icons/hicolor/scalable/status/megauptodate.svg
/usr/share/icons/hicolor/scalable/status/megasynching2.svg
/usr/share/icons/hicolor/scalable/status/megalogging.svg
/usr/share/icons/hicolor/scalable/status/megapaused.svg
into
/usr/share/icons/ubuntu-mono-dark/status/24/megawarning.svg
/usr/share/icons/ubuntu-mono-dark/status/24/megasynching.svg
/usr/share/icons/ubuntu-mono-dark/status/24/megauptodate.svg
/usr/share/icons/ubuntu-mono-dark/status/24/megalogging.svg
/usr/share/icons/ubuntu-mono-dark/status/24/megapaused.svg
and then probably need to update caches with
/bin/touch --no-create %{_datadir}/icons/hicolor
/bin/touch --no-create %{_datadir}/icons/ubuntu-mono-dark
gtk-update-icon-caches
Thanks for testing that
No problem! & Thanks for icons workaround.
Everything was OK, until I tried also logging in to my account on Firefox. At which point the
megasync
program began crashing. And then immediately upon re-launch. Clearing my user settings folder did allow me to then see a login screen. But immediately upon login in, it crashes again. This seems to be something strange.Here is a dump from existing user data folder (immediately upon startup, no GUI is shown)
and here is a crash dump from deleted user settings folder, then 'login screen' in the megasync utility window, then immediate crash upon clicking the 'login' button.
Cleared user data folder. Fresh login attempt. Correct username email. Incorrect password:
Then I can restart the program. This time the tray icon and it's menu loads up OK. 'Show Status' then opens the login screen (not logged in). And Settings goes to Proxies tab. But all the settings tabs and options are greyed out / cannot click on them.
At this point I try to login again. But this time with my correct password. And click 'Next'. It then asks me if i want a full sync or selective sync. I click 'skip'.
Can edit settings now. Then I try to add a sync folder, in there. I click on the 'local folder' text box. And it immediately crashes again. With the following dump:
And I didn't even finish the 'add sync folder' operation. Because had not selected the remote folder yet, the one in the mega account.
So basically: It can login without crashing. But cannot add any sync folders whatsoever. Immediately it crashes.