Bug 101376 - Wordcount Beanshell macro execution causes deadlock / hang requiring forced kill
Summary: Wordcount Beanshell macro execution causes deadlock / hang requiring forced kill
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.1.5.2 release
Hardware: x86-64 (AMD64) Mac OS X (All)
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest, haveBacktrace, regression
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2016-08-08 07:22 UTC by Alex Thurgood
Modified: 2019-07-05 08:16 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
backtrace from lldb debugging session (121.28 KB, text/plain)
2016-08-08 08:53 UTC, Alex Thurgood
Details
Apple stacktrace after LO hangs (1.20 MB, text/plain)
2018-09-19 11:16 UTC, Alex Thurgood
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Thurgood 2016-08-08 07:22:35 UTC
Testing the WordCount beanshell macro on OSX with master build causes LO to deadlock / freeze / hang  (beachball mode) requiring forced kill.
Comment 1 Alex Thurgood 2016-08-08 07:25:17 UTC
How to reproduce :

1) Open Writer document, type some text.
2) Select the text with mouse.
3) Tools > Macros > Run Macro > Wordcount > wordcount.bsh > Run
4) Hang until force kill
Comment 2 Alex Thurgood 2016-08-08 07:25:54 UTC
JDK 1.8.0_102
Comment 3 Alex Thurgood 2016-08-08 07:26:28 UTC
Version: 5.3.0.0.alpha0+
Build ID: 3e7a6544da370f641b21fd03a86a1c84d6ea6576
CPU Threads: 2; OS Version: Mac OS X 10.11.6; UI Render: default; 
Locale: fr-FR (fr.UTF-8); Calc: group
Comment 4 Alex Thurgood 2016-08-08 07:55:26 UTC
Tested against 

Version: 5.1.5.2
Build ID: 7a864d8825610a8c07cfc3bc01dd4fce6a9447e5
CPU Threads: 2; OS Version: Mac OS X 10.11.6; UI Render: default; 
Locale: fr-FR (fr.UTF-8); Calc: group

Reproducible also with this version.
Comment 5 Alex Thurgood 2016-08-08 08:04:06 UTC
Attempting the same procedure in LO 5032 causes a crash on execution of the macro, leading to a hung document recovery window requiring forced kill.
Comment 6 Alex Thurgood 2016-08-08 08:20:03 UTC
Attempting to reproduce with

Version: 5.0.0.4
Build ID: cf112dc905650fb985306a7a03d2fe3fcc6c978f
Locale: fr-FR (fr.UTF-8)

OSX 10.11.4

leads to complete crash after selecting the wordcount.bsh entry in Run Macro dialog and clicking on Run.
Comment 7 Alex Thurgood 2016-08-08 08:53:22 UTC
So, from what I can attempt to understand in the enclosed backtrace, there seems to be some incomaptibility in the JNF code that the script has to use which causes the JVM to sigsegv multiple times, and this nonetheless attempts to instantiate the macro dialog

warn:vcl:80504:1:vcl/source/window/dialog.cxx:788: Dialog::StartExecuteModal() - Parent not visible
Comment 8 Alex Thurgood 2016-08-08 08:53:55 UTC
Created attachment 126665 [details]
backtrace from lldb debugging session
Comment 9 Alex Thurgood 2016-08-08 08:54:25 UTC
@Stephan : one for you ?
Comment 10 Stephan Bergmann 2016-08-24 19:31:52 UTC
With my local master build and JDK 1.8.0_77, causes a crash as follows (and then goes beachball):

> * thread #1: tid = 0x20d09, 0x000000012aef9472 libjvm.dylib`ThreadStateTransition::trans_from_native(JavaThreadState) + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSEGV
>     frame #0: 0x000000012aef9472 libjvm.dylib`ThreadStateTransition::trans_from_native(JavaThreadState) + 10
> libjvm.dylib`ThreadStateTransition::trans_from_native:
> ->  0x12aef9472 <+10>: movl   $0x5, 0x270(%rbx)
>     0x12aef947c <+20>: leaq   0x77afb5(%rip), %rax      ; os::_processor_count
>     0x12aef9483 <+27>: movl   (%rax), %eax
>     0x12aef9485 <+29>: cmpl   $0x1, %eax
> (lldb) bt
> * thread #1: tid = 0x20d09, 0x000000012aef9472 libjvm.dylib`ThreadStateTransition::trans_from_native(JavaThreadState) + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSEGV
>   * frame #0: 0x000000012aef9472 libjvm.dylib`ThreadStateTransition::trans_from_native(JavaThreadState) + 10
>     frame #1: 0x000000012b0a1ab2 libjvm.dylib`jni_IsSameObject + 48
>     frame #2: 0x0000000146c681f5 JavaNativeFoundation`-[JNFWeakJObjectWrapper _getWithEnv:] + 37
>     frame #3: 0x0000000146c6848f JavaNativeFoundation`-[JNFJObjectWrapper jObjectWithEnv:] + 29
>     frame #4: 0x000000015189637c libawt_lwawt.dylib`-[AWTWindow _deliverMoveResizeEvent] + 164
>     frame #5: 0x00007fff96523bbc CoreFoundation`__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
>     frame #6: 0x00007fff96523b4f CoreFoundation`___CFXRegistrationPost_block_invoke + 63
>     frame #7: 0x00007fff96523ac7 CoreFoundation`_CFXRegistrationPost + 407
>     frame #8: 0x00007fff96523832 CoreFoundation`___CFXNotificationPost_block_invoke + 50
>     frame #9: 0x00007fff964e05e2 CoreFoundation`-[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
>     frame #10: 0x00007fff964df835 CoreFoundation`_CFXNotificationPost + 693
>     frame #11: 0x00007fff91fe017a Foundation`-[NSNotificationCenter postNotificationName:object:userInfo:] + 66
>     frame #12: 0x00007fff8fe7aa4a AppKit`-[NSWindow _setFrameCommon:display:stashSize:] + 3507
>     frame #13: 0x00007fff8fe79c88 AppKit`-[NSWindow _setFrame:display:allowImplicitAnimation:stashSize:] + 222
>     frame #14: 0x00007fff8fe79ba3 AppKit`-[NSWindow setFrame:display:] + 67
>     frame #15: 0x0000000151898970 libawt_lwawt.dylib`__Java_sun_lwawt_macosx_CPlatformWindow_nativeSetNSWindowBounds_block_invoke_1 + 284
>     frame #16: 0x0000000146c685f5 JavaNativeFoundation`+[JNFRunLoop _performCopiedBlock:] + 20
>     frame #17: 0x00007fff9204ffde Foundation`__NSThreadPerformPerform + 279
>     frame #18: 0x00007fff9652d881 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
>     frame #19: 0x00007fff9650cf37 CoreFoundation`__CFRunLoopDoSources0 + 423
>     frame #20: 0x00007fff9650c4df CoreFoundation`__CFRunLoopRun + 927
>     frame #21: 0x00007fff9650bed8 CoreFoundation`CFRunLoopRunSpecific + 296
>     frame #22: 0x00007fff8a534935 HIToolbox`RunCurrentEventLoopInMode + 235
>     frame #23: 0x00007fff8a534677 HIToolbox`ReceiveNextEventCommon + 184
>     frame #24: 0x00007fff8a5345af HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 71
>     frame #25: 0x00007fff8fda8df6 AppKit`_DPSNextEvent + 1067
>     frame #26: 0x00007fff8fda8226 AppKit`-[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
>     frame #27: 0x0000000106a838f6 libvcllo.dylib`AquaSalInstance::DoYield(this=0x000000010ecdd680, bWait=false, bHandleAllCurrentEvents=false, nReleased=0) + 998 at /Users/stephan/Software/lo/core/vcl/osx/salinst.cxx:623
>     frame #28: 0x000000010691dbec libvcllo.dylib`ImplYield(i_bWait=false, i_bAllEvents=false, nReleased=0) + 1788 at /Users/stephan/Software/lo/core/vcl/source/app/svapp.cxx:508
>     frame #29: 0x000000010691d4a8 libvcllo.dylib`Application::Yield() + 24 at /Users/stephan/Software/lo/core/vcl/source/app/svapp.cxx:555
>     frame #30: 0x000000010691d41e libvcllo.dylib`Application::Execute() + 478 at /Users/stephan/Software/lo/core/vcl/source/app/svapp.cxx:472
>     frame #31: 0x0000000100128679 libsofficeapp.dylib`desktop::Desktop::DoExecute() + 9 at /Users/stephan/Software/lo/core/desktop/source/app/app.cxx:1319
>     frame #32: 0x000000010012b817 libsofficeapp.dylib`desktop::Desktop::Main(this=0x00007fff5fbffad8) + 12695 at /Users/stephan/Software/lo/core/desktop/source/app/app.cxx:1646
>     frame #33: 0x000000010692be3a libvcllo.dylib`ImplSVMain() + 186 at /Users/stephan/Software/lo/core/vcl/source/app/svmain.cxx:185
>     frame #34: 0x0000000106a82d99 libvcllo.dylib`AquaSalInstance::handleAppDefinedEvent(pEvent=0x00000001147005f0) + 249 at /Users/stephan/Software/lo/core/vcl/osx/salinst.cxx:466
>     frame #35: 0x0000000106bd2ac0 libvcllo.dylib`-[VCL_NSApplication sendEvent:](self=0x000000010ed09000, _cmd="sendEvent:", pEvent=0x00000001147005f0) + 80 at /Users/stephan/Software/lo/core/vcl/osx/vclnsapp.mm:82
>     frame #36: 0x00007fff8fd9cdf2 AppKit`-[NSApplication run] + 796
>     frame #37: 0x00007fff8fd66368 AppKit`NSApplicationMain + 1176
>     frame #38: 0x0000000106a810da libvcllo.dylib`ImplSVMainHook(pnInit=0x00007fff5fbffa54) + 522 at /Users/stephan/Software/lo/core/vcl/osx/salinst.cxx:211
>     frame #39: 0x000000010692d75c libvcllo.dylib`SVMain() + 44 at /Users/stephan/Software/lo/core/vcl/source/app/svmain.cxx:220
>     frame #40: 0x000000010019e196 libsofficeapp.dylib`soffice_main + 534 at /Users/stephan/Software/lo/core/desktop/source/app/sofficemain.cxx:165
>     frame #41: 0x0000000100000f5d soffice`sal_main + 13 at /Users/stephan/Software/lo/core/desktop/source/app/main.c:48
>     frame #42: 0x0000000100000f37 soffice`main(argc=1, argv=0x00007fff5fbffbc0) + 39 at /Users/stephan/Software/lo/core/desktop/source/app/main.c:47
>     frame #43: 0x00007fff8a4495ad libdyld.dylib`start + 1
> (lldb) reg read rbx
>      rbx = 0x0000000000000000
Comment 11 Xisco Faulí 2016-09-13 09:34:03 UTC
Hi Alex,
Can you explain why it's a regression? it's because in 5.1.5.2 is hanging and in 5.0.0.4 is crashing?
Comment 12 Alex Thurgood 2017-09-15 12:27:41 UTC
I was convinced that this worked in earlier versions of LO, with an older version of OSX and JavaforOSX (Apple's own Java). However, as that is now defunct, and even when installed on OSX10.12 and recognized by LO (which is no longer systematic), all I get are error messages with the earlier versions of LO, but indeed, the earlier versions of LO don't crash.


Java error messages (attempt to instantiate JVM from thread that is not main), but no crash/hang with :

LO330
LO4162
LO4452

so the crash/hang is a regression over previous behaviour (which admittedly wasn't brilliant in and of itself).
Comment 13 QA Administrators 2018-09-16 02:49:04 UTC Comment hidden (obsolete)
Comment 14 Alex Thurgood 2018-09-19 11:15:54 UTC
Testing with

Version: 6.1.1.2
Build ID: 5d19a1bfa650b796764388cd8b33a5af1f5baa1b
Threads CPU : 8; OS : Mac OS X 10.13.6; UI Render : par défaut; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group threaded

causes an immediate closure of the Writer window, and the soffice process hangs, see enclosed Apple stack trace. A force kill is required to release the hung instance.
Comment 15 Alex Thurgood 2018-09-19 11:16:35 UTC
Created attachment 145011 [details]
Apple stacktrace after LO hangs
Comment 16 Alex Thurgood 2019-01-14 12:38:01 UTC
Testing in 

Version: 6.2.0.2
Build ID: 2ce5217b30a543f7666022df50f0562f82be0cff
CPU threads: 4; OS: Mac OS X 10.14.2; UI render: default; VCL: osx; 
Locale: fr-FR (fr_FR.UTF-8); UI-Language: en-US
Calc: threaded

displays an error message (in French) :

An undetected error has been identified. Choose "Continue" to keep running the application in an unstable state. Choose "Force Quit" to stop the application and create a bug report via the Crash Reporter. If you choose "Force Quit", any unsaved data will be lost.
Comment 17 Alex Thurgood 2019-01-14 12:39:20 UTC
Irrespective of the choices on offer in that error message, the app is unresponsive and so no button clicks on the error dialog can be activated.

Force kill via the system process manager is required.
Comment 18 Alex Thurgood 2019-01-14 12:42:06 UTC
@Jan Marek: saw you did some work recently on Beanshell instantiation and vcl lifecycle - perhaps this is similar to the problem you were adressing ?
Comment 19 Jan-Marek Glogowski 2019-01-17 09:30:55 UTC
(In reply to Alex Thurgood from comment #18)
> @Jan Marek: saw you did some work recently on Beanshell instantiation and
> vcl lifecycle - perhaps this is similar to the problem you were adressing ?

Feel free to test, if this is fixed by current master, but that just restores a working Beanshell editor.
Comment 20 Alex Thurgood 2019-07-05 08:16:40 UTC
Still happening with

Version: 6.4.0.0.alpha0+
Build ID: 75d35ef8df1936dd93d5919b688abcaddb58bee8
CPU threads: 4; OS: Mac OS X 10.14.5; UI render: default; VCL: osx; 
Locale: fr-FR (fr_FR.UTF-8); UI-Language: en-US
Calc: threaded

1) Start LO
2) Open a new Writer document
3) Tools > Macros > Run Macro
4) Select WordCount beanshell macro, click Run.
5) Crash, message displayed that LibreOffice crashed unexpectedly, no interaction with dialog possible, application is hung (beachball) and requires forced kill.