Bug 151894 - FILEOPEN a Base Document with customized event for open a startform by "open document" LO stuck
Summary: FILEOPEN a Base Document with customized event for open a startform by "open...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.3.7.2 release
Hardware: ARM macOS (All)
: high major
Assignee: Stephan Bergmann
URL:
Whiteboard: target:7.5.0
Keywords: regression
: 153177 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-11-04 10:50 UTC by Olaf Guse
Modified: 2023-01-25 10:20 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
TurnierDB start Druck by activated macro (11.86 KB, application/vnd.oasis.opendocument.database)
2022-11-04 10:52 UTC, Olaf Guse
Details
Spindump of hung soffice process (3.83 MB, text/plain)
2022-11-04 16:24 UTC, Alex Thurgood
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Guse 2022-11-04 10:50:40 UTC
Description:
The automatic opening of a start form with using customized event "open document" on macOS the LO stuck by open the form. This doesn't happen on LinuxOS - is verified by other user for LO 7.3.7.2  (see also BUG 151879 for LO 7.4.0.3 release)

Steps to Reproduce:
1.Open the attached database
2.A macro will be executed by event open document to open start form
3.

Actual Results:
LO stuck by open form

Expected Results:
Open of start form as verified on LinuxOS


Reproducible: Always


User Profile Reset: No

Additional Info:
Problem seems to be binden to macOS - hast to be verified 
macOS Big Sur Version 11.7.1
Comment 1 Olaf Guse 2022-11-04 10:52:42 UTC
Created attachment 183405 [details]
TurnierDB start Druck by activated macro
Comment 2 Alex Thurgood 2022-11-04 15:40:09 UTC
I can reproduce a hang condition requiring forced kill.


1) Load the file test DB file into LO7412 aarch 64 version (running on MacOS Arm Silicon M1) Ventura.

2) Click on the later button to cancel the Firebird migration assistant.

3) Double-click on the form to try and open it.

4) Soffice process hang (turnstile/spinning beachball).

5) Force kill, ignore LO file recovery, reload file. Instant hang.

Looking at the Apple trace produced when the hanging process is killed, you can see that the scheduler appears to be caught in a mutex lock/sync condition between two competing threads.
Comment 3 Alex Thurgood 2022-11-04 15:44:42 UTC
Sigh, subsequent attempts to reload the ODB file cause a hang after telling the migration wizard dialog to go away.

FWIW, disallowing the execution of Macros on file load, enables the form to be loaded and displayed.
Comment 4 Alex Thurgood 2022-11-04 16:24:14 UTC
Well a spindump of the hung process, show this, again :


1001  AquaSalInstance::DoYield(bool, bool) + 604 (libvclplug_osxlo.dylib + 137760) [0x107e25a20]
1001  -[VCL_NSApplication sendEvent:] + 1724 (libvclplug_osxlo.dylib + 343196) [0x107e57c9c]
1001  -[NSApplication(NSEvent) sendEvent:] + 1152 (AppKit + 1461652) [0x1a4dfbd94]
1001  -[NSWindow(NSEventRouting) sendEvent:] + 284 (AppKit + 1466204) [0x1a4dfcf5c]
1001  -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 3392 (AppKit + 1470064) [0x1a4dfde70]
1001  -[SalFrameView sendMouseEventToFrame:button:eventtype:] + 92 (libvclplug_osxlo.dylib + 325700) [0x107e53844]
1001  SalYieldMutex::doAcquire(unsigned int) + 268 (libvclplug_osxlo.dylib + 133760) [0x107e24a80]
1001  std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (libc++.1.dylib + 51908) [0x1a18e7ac4]
1001  __psynch_cvwait + 8 (libsystem_kernel.dylib + 17892) [0x1a195e5e4]
*1001  psynch_cvcontinue + 0 (com.apple.kec.pthread + 17920) [0xfffffe000b18ec30]

which is the same as bug 148435

I'd hasard a guess that the instantiation of the listener on accepting Macro execution cause the VCL scheduler to lock up, which is basically another way of triggering bug 148435.

*** This bug has been marked as a duplicate of bug 148435 ***
Comment 5 Alex Thurgood 2022-11-04 16:24:52 UTC
Created attachment 183418 [details]
Spindump of hung soffice process
Comment 6 Stephan Bergmann 2022-12-07 10:04:25 UTC
(In reply to Alex Thurgood from comment #5)
> Created attachment 183418 [details]
> Spindump of hung soffice process

The relevant part here is that a non-main thread (Thread 0x28b5b Thread name "DocumentEventNotifier") is calling [NSSpellChecker sharedSpellChecker], but apparently with the SolarMutex erroneously locked,

>     1001  _pthread_start + 148 (libsystem_pthread.dylib + 28780) [0x1a199a06c]
>       1001  osl_thread_start_Impl(void*) + 128 (libuno_sal.dylib.3 + 227684) [0x102b53964]
>         1001  threadFunc + 28 (libcomphelper.dylib + 287916) [0x102fb24ac]
>           1001  non-virtual thunk to comphelper::AsyncEventNotifierAutoJoin::run() + 36 (libcomphelper.dylib + 287576) [0x102fb2358]
>             1001  comphelper::AsyncEventNotifierBase::execute() + 244 (libcomphelper.dylib + 283748) [0x102fb1464]
>               1001  dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow(com::sun::star::document::DocumentEvent const&) + 168 (libdbalo.dylib + 1130412) [0x376ce3fac]
>                 1001  void comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::forEach<comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::NotifySingleListener<com::sun::star::document::DocumentEvent> >(comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::NotifySingleListener<com::sun::star::document::DocumentEvent> const&) + 156 (libdbalo.dylib + 1138600) [0x376ce5fa8]
>                   1001  dbaccess::DocumentEventExecutor::documentEventOccured(com::sun::star::document::DocumentEvent const&) + 1500 (libdbalo.dylib + 1125476) [0x376ce2c64]
>                     1001  non-virtual thunk to scripting_protocolhandler::ScriptProtocolHandler::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) + 52 (libprotocolhandlerlo.dylib + 13816) [0x37512b5f8]
>                       1001  scripting_protocolhandler::ScriptProtocolHandler::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) + 1292 (libprotocolhandlerlo.dylib + 7568) [0x375129d90]
>                         1001  basprov::BasicScriptImpl::invoke(com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) + 1168 (libbasprovlo.dylib + 63808) [0x375e27940]
>                           1001  SbMethod::Call(SbxValue*, SbxVariable*) + 232 (libsblo.dylib + 362948) [0x1032909c4]
>                             1001  SbxValue::Get(SbxValues&) const + 216 (libsblo.dylib + 977972) [0x103326c34]
>                               1001  SbMethod::Broadcast(SfxHintId) + 288 (libsblo.dylib + 363620) [0x103290c64]
>                                 1001  SfxBroadcaster::Broadcast(SfxHint const&) + 88 (libsvllo.dylib + 386820) [0x10377a704]
>                                   1001  SbModule::Notify(SfxBroadcaster&, SfxHint const&) + 1300 (libsblo.dylib + 345536) [0x10328c5c0]
>                                     1001  SbModule::Run(SbMethod*) + 1308 (libsblo.dylib + 347288) [0x10328cc98]
>                                       1001  SbiRuntime::Step() + 484 (libsblo.dylib + 726788) [0x1032e9704]
>                                         1001  SbiRuntime::StepELEM(unsigned int, unsigned int) + 532 (libsblo.dylib + 710068) [0x1032e55b4]
>                                           1001  SbiRuntime::FindElement(SbxObject*, unsigned int, unsigned int, ErrCode, bool, bool) + 1000 (libsblo.dylib + 748608) [0x1032eec40]
>                                             1001  SbxMethod::SbxMethod(SbxMethod const&) + 60 (libsblo.dylib + 958364) [0x103321f9c]
>                                               1001  SbxVariable::SbxVariable(SbxVariable const&) + 44 (libsblo.dylib + 991284) [0x10332a034]
>                                                 1001  SbxValue::SbxValue(SbxValue const&) + 168 (libsblo.dylib + 976196) [0x103326544]
>                                                   1001  SbxVariable::Broadcast(SfxHintId) + 308 (libsblo.dylib + 994000) [0x10332aad0]
>                                                     1001  SfxBroadcaster::Broadcast(SfxHint const&) + 88 (libsvllo.dylib + 386820) [0x10377a704]
>                                                       1001  SbUnoObject::Notify(SfxBroadcaster&, SfxHint const&) + 1884 (libsblo.dylib + 215164) [0x10326c87c]
>                                                         1001  stoc_corefl::(anonymous namespace)::IdlInterfaceMethodImpl::invoke(com::sun::star::uno::Any const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) + 1804 (libreflectionlo.dylib + 72068) [0x375ea5984]
>                                                           1001  unoInterfaceProxyDispatch + 620 (libgcc3_uno.dylib + 24148) [0x106b65e54]
>                                                             1001  (anonymous namespace)::call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) + 1824 (libgcc3_uno.dylib + 26024) [0x106b665a8]
>                                                               1001  callVirtualFunction(unsigned long, unsigned long*, unsigned long*, unsigned long*, int, void*) + 188 (libgcc3_uno.dylib + 14028) [0x106b636cc]
>                                                                 1001  dbaccess::ODocumentDefinition::impl_openUI_nolck_throw(bool) + 360 (libdbalo.dylib + 1104368) [0x376cdd9f0]
>                                                                   1001  dbaui::OApplicationController::loadComponent(int, rtl::OUString const&, unsigned char) + 184 (libdbulo.dylib + 156188) [0x38002621c]
>                                                                     1001  dbaui::OApplicationController::loadComponentWithArguments(int, rtl::OUString const&, unsigned char, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) + 220 (libdbulo.dylib + 156856) [0x3800264b8]
>                                                                       1001  dbaui::OApplicationController::openElementWithArguments(rtl::OUString const&, dbaui::ElementType, dbaui::ElementOpenMode, unsigned short, comphelper::NamedValueCollection const&) + 516 (libdbulo.dylib + 65844) [0x380010134]
>                                                                         1001  dbaui::OLinkedDocumentsAccess::open(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::lang::XComponent>&, dbaui::ElementOpenMode, comphelper::NamedValueCollection const&) + 108 (libdbulo.dylib + 1369916) [0x38014e73c]
>                                                                           1001  dbaui::OLinkedDocumentsAccess::impl_open(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::lang::XComponent>&, dbaui::ElementOpenMode, comphelper::NamedValueCollection const&) + 1108 (libdbulo.dylib + 1361768) [0x38014c768]
>                                                                             1001  dbaccess::ODocumentContainer::loadComponentFromURL(rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) + 984 (libdbalo.dylib + 1033752) [0x376ccc618]
>                                                                               1001  dbaccess::ODocumentDefinition::execute(com::sun::star::ucb::Command const&, int, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) + 2140 (libdbalo.dylib + 1080912) [0x376cd7e50]
>                                                                                 1001  dbaccess::ODocumentDefinition::onCommandOpenSomething(com::sun::star::uno::Any const&, bool, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) + 1796 (libdbalo.dylib + 1071128) [0x376cd5818]
>                                                                                   1001  dbaccess::ODocumentDefinition::loadEmbeddedObject(com::sun::star::uno::Reference<com::sun::star::sdbc::XConnection> const&, com::sun::star::uno::Sequence<signed char> const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, bool, bool) + 2748 (libdbalo.dylib + 1052852) [0x376cd10b4]
>                                                                                     1001  OCommonEmbeddedObject::changeState(int) + 244 (libembobj.dylib + 27632) [0x380c06bf0]
>                                                                                       1001  OCommonEmbeddedObject::SwitchStateTo_Impl(int) + 2376 (libembobj.dylib + 20204) [0x380c04eec]
>                                                                                         1001  OCommonEmbeddedObject::LoadDocumentFromStorage_Impl() + 136 (libembobj.dylib + 81552) [0x380c13e90]
>                                                                                           1001  CreateDocument(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&, bool, bool) + 412 (libembobj.dylib + 76252) [0x380c129dc]
>                                                                                             1001  cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) + 92 (libuno_cppuhelpergcc3.dylib.3 + 270916) [0x103172244]
>                                                                                               1001  cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) + 200 (libuno_cppuhelpergcc3.dylib.3 + 255632) [0x10316e690]
>                                                                                                 1001  cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) + 88 (libuno_cppuhelpergcc3.dylib.3 + 255864) [0x10316e778]
>                                                                                                   1001  Writer_SwTextDocument_get_implementation + 68 (libswlo.dylib + 9755552) [0x3c5d29ba0]
>                                                                                                     1001  rtl::Static<(anonymous namespace)::SwDLLInstance, (anonymous namespace)::theSwDLLInstance>::get() + 180 (libswlo.dylib + 8002928) [0x3c5b7dd70]
>                                                                                                       1001  SwDLL::SwDLL() + 184 (libswlo.dylib + 8003464) [0x3c5b7df88]
>                                                                                                         1001  SwModule::SwModule(SfxObjectFactory*, SfxObjectFactory*, SfxObjectFactory*) + 640 (libswlo.dylib + 8017284) [0x3c5b81584]
>                                                                                                           1001  SwLinguServiceEventListener::SwLinguServiceEventListener() + 228 (libswlo.dylib + 9703028) [0x3c5d1ce74]
>                                                                                                             1001  com::sun::star::linguistic2::LinguServiceManager::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) + 136 (libswlo.dylib + 9703976) [0x3c5d1d228]
>                                                                                                               1001  cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) + 80 (libuno_cppuhelpergcc3.dylib.3 + 270192) [0x103171f70]
>                                                                                                                 1001  cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool) + 104 (libuno_cppuhelpergcc3.dylib.3 + 254296) [0x10316e158]
>                                                                                                                   1001  cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) + 160 (libuno_cppuhelpergcc3.dylib.3 + 254676) [0x10316e2d4]
>                                                                                                                     1001  linguistic_LngSvcMgr_get_implementation + 28 (liblnglo.dylib + 312640) [0x106634540]
>                                                                                                                       1001  LngSvcMgr::LngSvcMgr() + 1000 (liblnglo.dylib + 258908) [0x10662735c]
>                                                                                                                         1001  LngSvcMgr::UpdateAll() + 544 (liblnglo.dylib + 261408) [0x106627d20]
>                                                                                                                           1001  LngSvcMgr::getAvailableServices(rtl::OUString const&, com::sun::star::lang::Locale const&) + 488 (liblnglo.dylib + 297812) [0x106630b54]
>                                                                                                                             1001  LngSvcMgr::GetAvailableSpellSvcs_Impl() + 948 (liblnglo.dylib + 288960) [0x10662e8c0]
>                                                                                                                               1001  MacSpellChecker::getLocales() + 116 (libMacOSXSpelllo.dylib + 19532) [0x376748c4c]
>                                                                                                                                 1001  +[NSSpellChecker sharedSpellChecker] + 140 (AppKit + 2037144) [0x1a4e88598]

At least one culprit appears to be the

>         ::SolarMutexGuard aSolarGuard;

in ODocumentDefinition::execute (dbaccess/source/core/dataaccess/documentdefinition.cxx) that was originally introduced in <https://git.libreoffice.org/core/+/7c5b2130b651f7417f1c16457b132f9d7d043422%5E!> "a little less deadlock-prone ...", but there may be even more places along the call chain that also (recursively) lock the SolarMutex.
Comment 7 Commit Notification 2022-12-07 11:06:12 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d193d65635de197efe32d97a99540a31a5455c41

tdf#151894 Pre-init NSSpellCHecker to avoid SolarMutex deadlock

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Olaf Guse 2022-12-10 10:47:12 UTC
(In reply to Commit Notification from comment #7)
> Stephan Bergmann committed a patch related to this issue.
> It has been pushed to "master":
> 
> https://git.libreoffice.org/core/commit/
> d193d65635de197efe32d97a99540a31a5455c41
> 
> tdf#151894 Pre-init NSSpellCHecker to avoid SolarMutex deadlock
> 
> It will be available in 7.5.0.
> 
> The patch should be included in the daily builds available at
> https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
> information about daily builds can be found at:
> https://wiki.documentfoundation.org/Testing_Daily_Builds
> 
> Affected users are encouraged to test the fix and report feedback.

Checked the new build for 7.6.0.0 alpha0+
Problem is fixed - great work.
Thanks.
Comment 9 Olaf Guse 2022-12-15 17:44:39 UTC
I have to (In reply to Commit Notification from comment #7)
> Stephan Bergmann committed a patch related to this issue.
> It has been pushed to "master":
> 
> https://git.libreoffice.org/core/commit/
> d193d65635de197efe32d97a99540a31a5455c41
> 
> tdf#151894 Pre-init NSSpellCHecker to avoid SolarMutex deadlock
> 
> It will be available in 7.5.0.
> 
> The patch should be included in the daily builds available at
> https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
> information about daily builds can be found at:
> https://wiki.documentfoundation.org/Testing_Daily_Builds
> 
> Affected users are encouraged to test the fix and report feedback.

The Bug is fixed but the build 7.6.0.0 is not stable. I have several crash after producing a report. The report gets generated but then suddenly LO crashes. Maybe other user can verify this behavior.
Comment 10 Stephan Bergmann 2023-01-25 10:20:14 UTC
*** Bug 153177 has been marked as a duplicate of this bug. ***