Bug 105231 - SEGFAULT (in 6.2) or exception with null message after repeated operations
Summary: SEGFAULT (in 6.2) or exception with null message after repeated operations
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3.0.0.beta2
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-10 08:27 UTC by Jim Avera
Modified: 2020-07-17 02:28 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
test case spreadsheet (t.ods) (186.28 KB, application/x-vnd.oasis.opendocument.spreadsheet)
2017-01-10 08:27 UTC, Jim Avera
Details
Data file (must be placed in /tmp/testdata.csv) (8.32 KB, text/plain)
2017-01-10 08:27 UTC, Jim Avera
Details
printscreen of error (182.87 KB, image/png)
2017-10-31 19:05 UTC, raal
Details
Backtrace (gdb log) from segfault. See comment #9 (182.72 KB, text/x-log)
2018-11-17 03:01 UTC, Jim Avera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Avera 2017-01-10 08:27:15 UTC
Created attachment 130296 [details]
test case spreadsheet (t.ods)

I use Basic macros which copy & paste from one sheet to another.  Sometimes the paste does not seem to do anything, or at least doesn't copy formulas.  I had to write Basic code to check the result where a formula is expected, and if no formula is found then repeat the copy & paste (with a warning), which then succeeds.  Again, this occurs fairly often but unpredictably and, sadly, not repeatably.

-> The bug might somehow depend on the state of the heap, or perhaps the specific virtual addresses of dynamically-loaded modules (which are randomized and vary between process invocations).   I suspect this because sometimes I load a spreadsheet and immediately run the macro and it fails; but if I exit without saving and repeat the same steps, it does not fail.  So it depends on some state which isn't part of the spreadsheet or its macros.

Anyway, I tried and failed to create a test case for that particular problem.

But in the process, I found numerous seemingly-bogus errors and exceptions which occur after a large number of operations.   One is a "null message" exception message from a call to <row object>.removeByIndex()

   BASIC runtime error.
   An exception occurred 
   Type: com.sun.star.uno.RuntimeException
   Message: .

Even if the the parameters(offset and count) were invalid, the exception message should say _something_ useful.  So I suspect the exception is bogus, i.e., not due to my macro logic error, or if it is, then the runtime system is confused enough that it could not show a useful error message.

STEPS TO REPRODUCE:

1. Download the attached demo spreadsheet (t.ods) and the test data file
2. Place the test data in /tmp/testdata.csv 
   That path is hard-coded in the spreadsheet, so it has to be there
3. Open the spreadsheet, and enable macros when prompted (or in Tools->Options->Security->MacroSecurity)
4. Repeatedly click the black "Disc+Reload" button

RESULTS: Eventually (after 10-20 iterations), a "null message" exception will occur, or some other unexplain(able) error.

I'm sorry this isn't cleaner, but I'm convinced there is some kind of corruption which results in incorrect behaviour, even if just the suppression of diagnostic messages.
Comment 1 Jim Avera 2017-01-10 08:27:57 UTC
Created attachment 130297 [details]
Data file (must be placed in /tmp/testdata.csv)
Comment 2 Buovjaga 2017-01-14 17:10:19 UTC
(In reply to Jim Avera from comment #0)
> Created attachment 130296 [details]
> test case spreadsheet (t.ods)
> 4. Repeatedly click the black "Disc+Reload" button

When I click it, this error dialog comes up

Inadmissible value or data type
Data types do not match

Highlighted line:
LastVal = CDbl( Right(LastVal,Len(LastVal)-1) )

I did copy the csv to /tmp/testdata.csv

Arch Linux 64-bit, KDE Plasma 5
Version: 5.4.0.0.alpha0+
Build ID: 57779b5f3a49fedd952aed70ddcce22f48b98ea5
CPU Threads: 8; OS Version: Linux 4.8; UI Render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on January 13th 2016
Comment 3 Julien Nabet 2017-01-14 23:09:39 UTC
On pc Debian x86-64 with master sources updated today, I don't reproduce the problem and have the same behaviour as Buovjaga.
Comment 4 raal 2017-07-04 05:10:41 UTC
(In reply to Julien Nabet from comment #3)
> On pc Debian x86-64 with master sources updated today, I don't reproduce the
> problem and have the same behaviour as Buovjaga.

You have to change locale to EN ( . as separator). In my case third run of macro froze whole LO. Will test again later. 
Version: 6.0.0.0.alpha0+
Build ID: 77f77c57d336ba041faf51e2168372d1e0962a19
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2017-06-29_23:40:47
Comment 5 Xisco Faulí 2017-10-31 17:54:26 UTC
(In reply to raal from comment #4)
> (In reply to Julien Nabet from comment #3)
> > On pc Debian x86-64 with master sources updated today, I don't reproduce the
> > problem and have the same behaviour as Buovjaga.
> 
> You have to change locale to EN ( . as separator). In my case third run of
> macro froze whole LO. Will test again later. 
> Version: 6.0.0.0.alpha0+
> Build ID: 77f77c57d336ba041faf51e2168372d1e0962a19
> CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk2; 
> TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time:
> 2017-06-29_23:40:47

@Raal, any update?
Comment 6 raal 2017-10-31 19:05:51 UTC
Created attachment 137408 [details]
printscreen of error

Version: 6.0.0.0.alpha1+
Build ID: 60a03d97bc35c02cb1eff0e4a02b6f37fd1a6a34
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3; 

LibreOffice crashes when running macro.
Comment 7 Julien Nabet 2017-10-31 21:13:10 UTC
On pc Debian x6-64 with master sources updated today + English locale (with "." separator), I could reproduce this.
I had the error message in popup:
"PASTE DID NOT WORK!
sym=EXPDOptCx=10LastRow=204
Formula Cells PasteAddr=EXPD.$K$8:AD205
Click YES to continue anyway, NO to retry"

On console, I got lots of messages, eg:
warn:legacy.osl:11639:11639:sc/source/ui/unoobj/cellsuno.cxx:4725: What ranges ?!?!
warn:legacy.osl:11639:11639:sc/source/ui/unoobj/cellsuno.cxx:5977: What ranges ?!?!
warn:sc.core:11639:11639:sc/source/core/data/bcaslot.cxx:1146: ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas - pArea has no listeners and should had been removed already
warn:sc.core:11639:11639:sc/source/core/data/bcaslot.cxx:1146: ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas - pArea has no listeners and should had been removed already
warn:basic.sbx:11639:11639:basic/source/sbx/sbxvalue.cxx:759: Not at Parent-Prop - otherwise CyclicRef
Comment 8 QA Administrators 2018-11-01 03:51:59 UTC Comment hidden (obsolete)
Comment 9 Jim Avera 2018-11-17 03:00:14 UTC
Segfault in libsclo.so on Linux using latest master (downloaded 11/16/2018).
I'll attach a gdb trace.

For me, it crashes reliably after clicking the black button 4 or 5 times.

The following appeared on stdout or stderr:

** (soffice:5622): WARNING **: 18:53:54.119: Exception caught processing focus events

** (soffice:5622): WARNING **: 18:54:00.659: Exception caught processing focus events
Comment 10 Jim Avera 2018-11-17 03:01:35 UTC
Created attachment 146701 [details]
Backtrace (gdb log) from segfault.  See comment #9
Comment 11 QA Administrators 2019-11-18 03:28:11 UTC Comment hidden (obsolete)
Comment 12 Jim Avera 2020-07-17 02:28:57 UTC
Seems to be fixed in 7.1.0.0.alpha0 (master)