Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instant crash at start #1458

Closed
xf- opened this issue Sep 30, 2019 · 10 comments · Fixed by #2540
Closed

Instant crash at start #1458

xf- opened this issue Sep 30, 2019 · 10 comments · Fixed by #2540
Labels
approved bug approved by the team bug os: 🐧 Linux
Milestone

Comments

@xf-
Copy link

xf- commented Sep 30, 2019

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

@yan12125
Copy link
Contributor

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-

@camilasan
Copy link
Member

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

@camilasan
Copy link
Member

PR opened #1461

@yan12125
Copy link
Contributor

yan12125 commented Sep 30, 2019

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.

@camilasan
Copy link
Member

😢

Will check it tomorrow.

@yan12125
Copy link
Contributor

yan12125 commented Oct 1, 2019

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

@yan12125
Copy link
Contributor

From #1458 (comment)

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.

@yan12125
Copy link
Contributor

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 481d8d3 in my local build as empty ~/.config/Nextcloud/sync-exclude.lst does not cause a crash. Maybe more fixes are needed besides #1461.

@camilasan camilasan modified the milestones: 2.6.1, 2.6.2 Nov 21, 2019
@er-vin
Copy link
Member

er-vin commented May 20, 2020

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

@er-vin er-vin removed this from the 2.6.2 milestone May 20, 2020
@yan12125
Copy link
Contributor

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

@er-vin er-vin added this to the 2.6.5 milestone May 22, 2020
@er-vin er-vin added approved bug approved by the team and removed 0. Needs triage labels Jun 10, 2020
svenstaro pushed a commit to archlinux/svntogit-community that referenced this issue Jul 22, 2020
* Add a patch for FS#63939

Upstream issue: nextcloud/desktop#1458
Upstream fix: nextcloud/desktop#1461 (merged)

git-svn-id: file:///srv/repos/svn-community/svn@512305 9fca08f4-af9d-4005-b8df-a31f2cc04f65
svenstaro pushed a commit to archlinux/svntogit-community that referenced this issue Jul 22, 2020
Add more patches/workarounds for crashes mentioned in nextcloud/desktop#1458

git-svn-id: file:///srv/repos/svn-community/svn@520346 9fca08f4-af9d-4005-b8df-a31f2cc04f65
svenstaro pushed a commit to archlinux/svntogit-community that referenced this issue Jul 22, 2020
…drop unneeded patches; temporarily disable PGP verification

Relevant bugs for dropped patches are still not fixed [1]. However, as now the
build type is None, Q_ASSERT statements have no effects.

See [2] for why PGP is disabled.

[1] nextcloud/desktop#1458
[2] nextcloud/desktop#2185

git-svn-id: file:///srv/repos/svn-community/svn@663099 9fca08f4-af9d-4005-b8df-a31f2cc04f65
camilasan pushed a commit that referenced this issue Oct 28, 2020
This Q_ASSERT(this->endsWith('/')) in BasePathByteArray was the reason
for bug report #1458.

Signed-off-by: Camila <hello@camila.codes>
camilasan pushed a commit that referenced this issue Nov 26, 2020
This Q_ASSERT(this->endsWith('/')) in BasePathByteArray was the reason
for bug report #1458.

Signed-off-by: Camila <hello@camila.codes>
camilasan pushed a commit that referenced this issue Nov 26, 2020
This Q_ASSERT(this->endsWith('/')) in BasePathByteArray was the reason
for bug report #1458.

Signed-off-by: Camila <hello@camila.codes>
camilasan pushed a commit that referenced this issue Nov 26, 2020
This Q_ASSERT(this->endsWith('/')) in BasePathByteArray was the reason
for bug report #1458.

Signed-off-by: Camila <hello@camila.codes>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved bug approved by the team bug os: 🐧 Linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants