LibraryScanner is not canceled if Mixxx is closed

Bug #1018589 reported by Max Linke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Low
Max Linke

Bug Description

The scanner continues to run if mixxx is closed. We should send a cancel signal to it when exiting mixxx

Related branches

Revision history for this message
Max Linke (max-linke) wrote :
Download full text (3.3 KiB)

Also if the library scanner is canceled afterwards mixxx will close with a segfault. Here is the backtrace

Thread 9 (Thread 0x7fffde513700 (LWP 23321)):
#0 pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1 0x00007ffff597920b in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2 0x000000000061897a in BrowseThread::run (this=0xf8e350) at src/library/browse/browsethread.cpp:82
#3 0x00007ffff5978d0b in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4 0x00007ffff0ae9b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#5 0x00007ffff0fdf6dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fffe09c9700 (LWP 23314)):
#0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:39
#1 0x00007ffff59777f4 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2 0x00007ffff5973a05 in QMutex::lockInternal() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3 0x00007ffff59791b9 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4 0x00000000004e1432 in EngineWorkerScheduler::run (this=0xeb3f90) at src/engine/engineworkerscheduler.cpp:68
#5 0x00007ffff5978d0b in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6 0x00007ffff0ae9b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#7 0x00007ffff0fdf6dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#8 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7e9f780 (LWP 23304)):
#0 malloc_consolidate (av=0x7ffff1289e60) at malloc.c:5153
#1 0x00007ffff0f7e478 in _int_free (av=0x7ffff1289e60, p=0x2bd7460) at malloc.c:5034
#2 0x00007ffff0f8187c in *__GI___libc_free (mem=<optimized out>) at malloc.c:3738
#3 0x00000000005cac75 in free (alignment=8, x=0x2bd7470) at /usr/share/qt4/include/QtCore/qvector.h:99
#4 free (x=0x2bd7470, this=<optimized out>) at /usr/share/qt4/include/QtCore/qvector.h:468
#5 ~QVector (this=0xf746f8, __in_chrg=<optimized out>) at /usr/share/qt4/include/QtCore/qvector.h:124
#6 BaseSqlTableModel::~BaseSqlTableModel (this=0xf74670, __in_chrg=<optimized out>) at src/library/basesqltablemodel.cpp:32
#7 0x00000000005dfeb8 in ~LibraryTableModel (this=0xf74670, __in_chrg=<optimized out>) at src/library/librarytablemodel.cpp:50
#8 LibraryTableModel::~LibraryTableModel (this=0xf74670, __in_chrg=<optimized out>) at src/library/librarytablemodel.cpp:51
#9 0x00000000006012cd in MixxxLibraryFeature::~MixxxLibraryFeature (this=0xf5cff0, __in_chrg=<optimized out>) at src/library/mixxxlibraryfeature.cpp:102
#10 0x0000000000601409 in MixxxLibraryFeature::~MixxxLibraryFeature (this=0xf5cff0, __in_chrg=<optimized out>) at src/library/mixxxlibraryfeature.cpp:105
#11 0x00000000006720df in Library::~Library (this=0x7fffd8051a70, __in_chrg=<optimized out>) at src/library/library.cpp:97
#12 0x00000000006721e9 in Library::~Library (this=0x7fffd8051a70, __in_chrg=<optimized out>) at src/library/library.cpp:107
#13 0x000000000057c3e1 in MixxxApp::~MixxxApp (this=0xeae4f0, __in_chrg=<optimized out>) at src/mixxx.cpp:568
#14 0x000000000057d0c9 i...

Read more...

Revision history for this message
Max Linke (max-linke) wrote :

this cancels the scan when mixxx is closed. I tried it a few times and it worked everytime

Changed in mixxx:
assignee: nobody → Max Linke (max-linke)
status: New → In Progress
Revision history for this message
Daniel Schürmann (daschuer) wrote :

Hi Max,

thank you for the patch.

I am not sure if it is still needed. I am not able to reproduce the problem with the current lp:mixxx/1.11.

In the current code, the LibraryScanner::~LibraryScanner() properly cancels the library scanner. If this still causes a segfault, we should drill the bug down and solve it on is roots.

Daniel

Revision history for this message
Max Linke (max-linke) wrote :

Hi

Yeah in the current version the LibraryScanner is destroyed correctly.
The patch is still needed though as it didn't took care of the segfault but canceled the scan when the main window of mixxx is closed and this problem still exists

Revision history for this message
Max Linke (max-linke) wrote :

I found a solution that is nicer for me and let's the destructor handle all the work of canceling a scan when mixxx is closed.
If we simply remove a connection from the main app that it should close when the last window is closed Qt will then try to quit once the main window is closed. This is the default behavior of Qt see [1]. If also tested the it would still prompt a dialog when a song is playing or the preferences dialog is open. The prompt still shows and a shutdown of mixxx can be canceled.

[1] http://qt-project.org/doc/qt-4.8/qapplication.html#quitOnLastWindowClosed-prop

RJ Skerry-Ryan (rryan)
Changed in mixxx:
milestone: none → 1.11.0
Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

I wonder if the LibraryScanner dialog qualifies as a main window though. It's a widget with no parent so I think Qt would also wait for the widget to close before quitting.

Revision history for this message
Max Linke (max-linke) wrote :

Qt will only wait when you tell it to close only when all windows are closed. When we don't tell this Qt explicitly it will close all open windows once the main window is closed. I like that behavior since that's what I expect when I close an app

Revision history for this message
Max Linke (max-linke) wrote :

I noticed the old patch does nothing. This should solve this cleanly

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

Nice! please commit

Max Linke (max-linke)
Changed in mixxx:
status: In Progress → Fix Committed
importance: Undecided → Low
RJ Skerry-Ryan (rryan)
Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/6546

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.