grame-cncm / faustlive

Advanced self-contained prototyping environment for the Faust programming language
Other
80 stars 18 forks source link

[regression in 2.5.16] SEGV in mutex lock function #58

Open yurivict opened 1 year ago

yurivict commented 1 year ago

2.5.16 SEGVs in TMutex.h in the function Lock:

Thread 1 received signal SIGSEGV, Segmentation fault.
Address not mapped to object.
mutex_lock_common (abstime=0x0, cvattach=false, rb_onlist=false, m=<optimized out>) at /disk-samsung/freebsd-src/lib/libthr/thread/thr_mutex.c:726
726             if (!cvattach && m->m_flags & PMUTEX_FLAG_PRIVATE)
(gdb) bt
#0  mutex_lock_common (abstime=0x0, cvattach=false, rb_onlist=false, m=<optimized out>) at /disk-samsung/freebsd-src/lib/libthr/thread/thr_mutex.c:726
#1  __Tthr_mutex_lock (mutex=<optimized out>) at /disk-samsung/freebsd-src/lib/libthr/thread/thr_mutex.c:755
#2  0x00000000005a66ad in TMutex::Lock() (this=<optimized out>) at /usr/ports/audio/faustlive/work/faustlive-2.5.16/Build/../src/Utilities/TMutex.h:91
#3  FLInterfaceManager::updateAllGuis() (this=<optimized out>) at /usr/ports/audio/faustlive/work/faustlive-2.5.16/src/MainStructure/FLInterfaceManager.cpp:29
#4  0x0000000809136b1f in  () at /usr/local/lib/qt6/libQt6Core.so.6
#5  0x0000000809149eed in QTimer::timerEvent(QTimerEvent*) () at /usr/local/lib/qt6/libQt6Core.so.6
#6  0x000000080912ab4a in QObject::event(QEvent*) () at /usr/local/lib/qt6/libQt6Core.so.6
#7  0x00000008014f224a in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/local/lib/qt6/libQt6Widgets.so.6
#8  0x00000008014f318a in QApplication::notify(QObject*, QEvent*) () at /usr/local/lib/qt6/libQt6Widgets.so.6
#9  0x00000008090e2a10 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/local/lib/qt6/libQt6Core.so.6
#10 0x000000080926b5f1 in QTimerInfoList::activateTimers() () at /usr/local/lib/qt6/libQt6Core.so.6
#11 0x0000000809354901 in  () at /usr/local/lib/qt6/libQt6Core.so.6
#12 0x000000080a66cc54 in g_main_context_dispatch () at /usr/local/lib/libglib-2.0.so.0
#13 0x000000080a66cf8c in  () at /usr/local/lib/libglib-2.0.so.0
#14 0x000000080a66d038 in g_main_context_iteration () at /usr/local/lib/libglib-2.0.so.0
#15 0x0000000809353e59 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/local/lib/qt6/libQt6Core.so.6
#16 0x00000008090ebb87 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/local/lib/qt6/libQt6Core.so.6
#17 0x00000008090e3161 in QCoreApplication::exec() () at /usr/local/lib/qt6/libQt6Core.so.6
#18 0x0000000000621e05 in main(int, char**) (argc=<optimized out>, argv=0x7fffffffe6c0) at /usr/ports/audio/faustlive/work/faustlive-2.5.16/src/Utilities/main.cpp:116
(gdb) 
 79│                         pthread_mutexattr_t mutex_attr;
 80│                         assert(pthread_mutexattr_init(&mutex_attr) == 0);
 81│                         assert(pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE) == 0);
 82│                         assert(pthread_mutex_init(&fMutex, &mutex_attr) == 0);
 83│                 }
 84│                 virtual ~TMutex()
 85│                 {
 86│                         pthread_mutex_destroy(&fMutex);
 87│                 }
 88│
 89│                 bool Lock()
 90│                 {
 91├───────────> return (pthread_mutex_lock(&fMutex) == 0);
 92│                 }
 93│
 94│                 bool TryLock()
 95│                 {
 96│                         return (pthread_mutex_trylock(&fMutex) == 0);
 97│                 }
 98│
 99│                 void Unlock()
100│                 {
101│                         pthread_mutex_unlock(&fMutex);
102│                 }

The debug build doesn't crash.

clang-16 FreeBSD 13.2

ghost commented 9 months ago

fixed in https://github.com/grame-cncm/faustlive/pull/59

can't put code inside asserts.