Desktop: Instant crash at start

Created on 30 Sep 2019  路  10Comments  路  Source: nextcloud/desktop

Expected behaviour

Applicaiton starts

Actual behaviour

Applicaiton crashes

Steps to reproduce

  1. Start the application

Client configuration

Client version: 2.6.0 (Arch Linux testing)
Operating system: Arch Linux

Qt version used by client package (Linux only, see also Settings dialog): 5.13.1

Client package (From Nextcloud or distro) (Linux only): distro

Installation path of client:

Server configuration


Nextcloud version: 17.0.0 & 16.0.5

Logs

Please use Gist (https://gist.github.com/) or a similar code paster for longer
logs.


  1. Client logfile: Output of nextcloud --logwindow or nextcloud --logfile log.txt
[OCC::Application::setupLogging         "################## Nextcloud locale:[en_US] ui_lang:[] version:[2.6.0git] os:[Arch Linux]"
[OCC::Application::setupTranslations    Using "en_US" translation
[OCC::SocketApi::SocketApi      server started, listening at  "/run/user/1000/Nextcloud/socket"
[OCC::FolderMan::FolderMan      setting remote poll timer interval to 5000 msec
[OCC::AccountManager::loadAccountHelper         Account for QUrl("https://your.server/nextcloud") using auth type "webflow"
[OCC::WebFlowCredentials::createQNAM    Get QNAM
[OCC::AccountManager::loadAccountHelper         Account for QUrl("https://second.server") using auth type "webflow"
[OCC::WebFlowCredentials::createQNAM    Get QNAM
[OCC::ownCloudGui::setupContextMenu     Tray menu workarounds: noabouttoshow: false fakedoubleclick: false showhide: false manualvisibility: false
[OCC::AccessManager::createRequest      6 "GET" "https://your.server/nextcloud/ocs/v2.php/core/navigation/apps?absolute=true&format=json" has X-Request-ID "3a515b65-78a0-460d-9cdc-276ab8b751c5"
[OCC::AbstractNetworkJob::start         OCC::OcsNavigationAppsJob created for "https://your.server/nextcloud" + "ocs/v2.php/core/navigation/apps" ""
[OCC::AccessManager::createRequest      6 "GET" "https://second.server/ocs/v2.php/core/navigation/apps?absolute=true&format=json" has X-Request-ID "c3226844-c179-4fdf-9ffa-1fe6521a281a"
[OCC::AbstractNetworkJob::start         OCC::OcsNavigationAppsJob created for "https://second.server" + "ocs/v2.php/core/navigation/apps" ""
[OCC::FolderMan::setupFolders   Setup folders from settings file
[OCC::ConfigFile::setupDefaultExcludeFilePaths  Adding user defined ignore list to csync: "/home/username/.config/Nextcloud/sync-exclude.lst"
[unknown        ASSERT: "_allExcludes.contains(basePath)" in file /build/nextcloud-client/src/nextcloud-client/src/csync/csync_exclude.cpp, line 668



gdb

#0  0x00007fffee962755 in raise () from /usr/lib/libc.so.6
#1  0x00007fffee94d851 in abort () from /usr/lib/libc.so.6
#2  0x00007fffeeebc8f8 in QMessageLogger::fatal(char const*, ...) const () from /usr/lib/libQt5Core.so.5
#3  0x00007fffeeebbd0c in qt_assert(char const*, char const*, int) () from /usr/lib/libQt5Core.so.5
#4  0x00007ffff7cb7328 in ?? () from /usr/lib/nextcloud/libocsync.so.0
#5  0x00007ffff7ce4faf in ExcludedFiles::loadExcludeFile(QByteArray const&, QString const&) () from /usr/lib/nextcloud/libocsync.so.0
#6  0x00007ffff7ce54cf in ExcludedFiles::reloadExcludeFiles() () from /usr/lib/nextcloud/libocsync.so.0
#7  0x000055555564919a in OCC::Folder::Folder(OCC::FolderDefinition const&, OCC::AccountState*, QObject*) ()
#8  0x0000555555652228 in OCC::FolderMan::addFolderInternal(OCC::FolderDefinition, OCC::AccountState*) ()
#9  0x0000555555653624 in OCC::FolderMan::setupFoldersHelper(QSettings&, QExplicitlySharedDataPointer<OCC::AccountState>, bool) ()
#10 0x0000555555656402 in OCC::FolderMan::setupFolders() ()
#11 0x00005555556366f5 in OCC::Application::Application(int&, char**) ()
#12 0x0000555555603e56 in main ()

Arch Linux Ticket
https://bugs.archlinux.org/task/63939?project=5&string=nextcloud-client @yan12125

approved bug os Linux

Most helpful comment

I was able to reproduce it. Working in the fix.

All 10 comments

Reading the logs and the code again, I found a cause of such a crash - it happens when /home/username/.config/Nextcloud/sync-exclude.lst is empty (0 bytes). Is this the case for you? @xf-

I was able to reproduce it. Working in the fix.

PR opened #1461

I tested it - works fine!

But seems there is another bug. With 2.6.0 + #1461, if I create a folder-specific exclude list (e.g., ~/Nextcloud/Documents/.sync-exclude.lst), whether empty or non-empty, the application crashes at another place:

[unknown    ASSERT: "this->endsWith('/')" in file /build/nextcloud-client/src/nextcloud-client/src/csync/csync_exclude.h, line 180

gdb backtrace:

#0  0x00007fffee98f755 in raise () at /usr/lib/libc.so.6
#1  0x00007fffee97a851 in abort () at /usr/lib/libc.so.6
#2  0x00007fffeeee98f8 in  () at /usr/lib/libQt5Core.so.5
#3  0x00007fffeeee8d0c in qt_assert_x(char const*, char const*, char const*, int) () at /usr/lib/libQt5Core.so.5
#4  0x00007ffff7d14e87 in ExcludedFiles::BasePathByteArray::BasePathByteArray(QByteArray const&) ()
    at /usr/lib/nextcloud/libocsync.so.0
#5  0x00007ffff7d11f3c in ExcludedFiles::loadExcludeFile(QByteArray const&, QString const&) ()
    at /usr/lib/nextcloud/libocsync.so.0
#6  0x00007ffff7d14b76 in ExcludedFiles::traversalPatternMatch(char const*, ItemType) () at /usr/lib/nextcloud/libocsync.so.0
#7  0x00007ffff7d1d8fd in  () at /usr/lib/nextcloud/libocsync.so.0
#8  0x00007ffff7d1f892 in csync_walker(csync_s*, std::unique_ptr<csync_file_stat_s, std::default_delete<csync_file_stat_s> >) ()
    at /usr/lib/nextcloud/libocsync.so.0
#9  0x00007ffff7d1c541 in csync_ftw(csync_s*, char const*, int (*)(csync_s*, std::unique_ptr<csync_file_stat_s, std::default_delete<csync_file_stat_s> >), unsigned int) () at /usr/lib/nextcloud/libocsync.so.0                                                  
#10 0x00007ffff7d09cf2 in csync_update(csync_s*) () at /usr/lib/nextcloud/libocsync.so.0
#11 0x00007ffff7ddc988 in OCC::DiscoveryJob::start() () at /usr/lib/libnextcloudsync.so.0
#12 0x00007ffff7da9edb in  () at /usr/lib/libnextcloudsync.so.0
#13 0x00007fffef11f44a in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#14 0x00007fffefaac4f5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#15 0x00007fffefab5e11 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#16 0x00007fffef0f29c2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#17 0x00007fffef0f5739 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#18 0x00007fffef14b404 in  () at /usr/lib/libQt5Core.so.5
#19 0x00007fffee21a3ae in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#20 0x00007fffee21c1c1 in  () at /usr/lib/libglib-2.0.so.0
#21 0x00007fffee21c201 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#22 0x00007fffef14aa03 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/libQt5Core.so.5
#23 0x00007fffef0f14ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#24 0x00007fffeef23385 in QThread::exec() () at /usr/lib/libQt5Core.so.5
#25 0x00007fffeef245b0 in  () at /usr/lib/libQt5Core.so.5
#26 0x00007fffee93d57f in start_thread () at /usr/lib/libpthread.so.0
#27 0x00007fffeea510e3 in clone () at /usr/lib/libc.so.6

Looks like BasePathByteArray expects a folder path but a file path is passed.

EDIT: Sorry I didn't check carefully. The crash above occurs only when ~/.config/Nextcloud/sync-exclude.lst is not empty.

:cry:

Will check it tomorrow.

Thanks for the PR! I backported it to the Arch Linux package nextcloud-client first: https://git.archlinux.org/svntogit/community.git/commit/trunk?h=packages/nextcloud-client&id=531d7f3adccba2bbbcaae95e12696a8470ae4427

From https://github.com/nextcloud/desktop/issues/1458#issuecomment-536718365

The crash above occurs only when ~/.config/Nextcloud/sync-exclude.lst is not empty.

I investigated why the crash above depends on the global exclude list. Looks like the cause is #1461. If ~/.config/Nextcloud/sync-exclude.lst is empty, then ExcludedFiles::traversalPatternMatch() returns immediately as _allExcludes.isEmpty() is true. In other words, fodler-specific exclude lists are not loaded if the global exclude list is empty.

Now the crash itself. In my test case (/home/yen/Nextcloud/Documents/.sync-exclude.lst), gdb tells me that BasePathByteArray() is passed with "/home/yen/Nextcloud/Documents" when the assertion failure occurs. Seems folder-specific exclude lists work as long as base paths are folders, I would say that assertion is not needed or incorrect.

I give it another try - commenting out Q_ASSERT statements in BasePathByteArray constructors. There is another crash - if ~/.config/Nextcloud/sync-exclude.lst is not empty and a directory-specific exclude list (e.g., ~/Nextcloud/Documents/.sync-exclude.lst) is empty,

[unknown    ASSERT: "_allExcludes.contains(basePath)" in file /build/nextcloud-client/src/nextcloud-client/src/csync/csync_exclude.cpp, line 672

It is similar to the originally-reported crash. I'm sure I have included 481d8d3a0bcd26a3fd2b0d4fc6fb009260092bb1 in my local build as empty ~/.config/Nextcloud/sync-exclude.lst does not cause a crash. Maybe more fixes are needed besides #1461.

Does it still applies on 2.6.4? Could you check please? Thanks in advance.

Yes, I still got the following crash with non-empty ~/.config/Nextcloud/sync-exclude.lst and empty or non-empty ~/.config/Nextcloud/sync-exclude.lst

[unknown ASSERT: "this->endsWith('/')" in file /build/nextcloud-client/src/nextcloud-client/src/csync/csync_exclude.h, line 180

Was this page helpful?
0 / 5 - 0 ratings

Related issues

linucksrox picture linucksrox  路  3Comments

steven-omaha picture steven-omaha  路  3Comments

DBLouis picture DBLouis  路  3Comments

Ackis picture Ackis  路  4Comments

despens picture despens  路  3Comments