bugGNU Octave - Bugs: bug #54431, GUI crashes on workspace refresh...


bug #54431: GUI crashes on workspace refresh while executing script

Submitter:  Charles Praplan <charprap>
Submitted:  Thu 02 Aug 2018 03:50:52 PM UTC
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Charles Praplan Open/Closed:  * Closed
Release:  * 4.4.1 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Sun 03 Mar 2019 01:58:05 AM UTC, comment #15: 

Yeah, this is fixed now, I added a for loop around the script in comment #13 just to make sure it's not finishing too quickly. With a debug breakpoint set and dbstep run repeatedly by holding down the Enter key, I can definitely see the workspace panel updating, and Octave doesn't crash now.

Mike Miller <mtmiller>
Project Administrator
Sat 02 Mar 2019 09:43:07 PM UTC, comment #14: 

@Mike: Is this still a problem with the 5.1.0 release?

Rik <rik5>
Project Administrator
Mon 17 Sep 2018 09:13:05 PM UTC, comment #13: 

Reposting a simpler example from bug #54656 that also causes Octave to crash in the same way.

a = ones (10000000, 1);
b = sort (a);
clear a;
b = [];
a = ones (1048576, 1);
b = sort (a);

This should be saved as a script file and run from within the GUI. It will crash in Octave 4.4 as is, and it will crash in Octave 5 with the debugger active and the Enter key held down to dbstep rapidly.

Mike Miller <mtmiller>
Project Administrator
Fri 10 Aug 2018 05:46:52 PM UTC, comment #12: 

With the devleopment version of Octave 5, this crash is now avoided even with the clear command used in a script.

However, the crash still occurs when setting a debug breakpoint on the original script, entering the 'dbnext' command, and holding down the Enter key.

So there still appears to be some unsafe interaction between running a script and refreshing the workspace panel when a tf object is in the global workspace.

Mike Miller <mtmiller>
Project Administrator
Sat 04 Aug 2018 07:22:40 PM UTC, comment #11: 

The following much simpler script demonstrates the crash on my system.

pkg load control
sys = tf (1, [1, 1]);
for i = 1:10
  clear nosuchvariable

Mike Miller <mtmiller>
Project Administrator
Sat 04 Aug 2018 12:02:02 AM UTC, comment #10: 


I filed a related bug #54443. But even if the GUI is fixed so that 'clear' does not cause the workspace panel to refresh unexpectedly, this crash can still be triggered by debug-stepping through the script.

Mike Miller <mtmiller>
Project Administrator
Fri 03 Aug 2018 04:31:30 PM UTC, comment #9: 

Yes, I can confirm the behavior when commenting out line 56.

Charles Praplan <charprap>
Fri 03 Aug 2018 04:11:30 PM UTC, comment #8: 

Also, even with this line removed, timing is an issue here.

If I do the following

dbstop final_test_case

Being in debug mode also allows the workspace panel to be updated every time control is returned to the user.

Hitting Enter allows one to step through the entire script. If I press Enter repeatedly, at a slow pace, there is no crash. If I hold down the Enter key, the crash returns.

Mike Miller <mtmiller>
Project Administrator
Fri 03 Aug 2018 04:05:23 PM UTC, comment #7: 

I don't have a minimum reproducer for this crash yet, but it is definitely due to the workspace model being updated while the script is running.

The only reason the workspace model is updated is because the script calls 'clear' on line 56.

If I comment out line 56, there is no crash. Charles, can you confirm that you see the same?

Mike Miller <mtmiller>
Project Administrator
Fri 03 Aug 2018 08:23:16 AM UTC, comment #6: 

Mike, I guess that the question you asked me (about a variable named 'error') is no more of actuality.
However, I don't think I use a variable named 'error'.

Charles Praplan <charprap>
Thu 02 Aug 2018 07:32:55 PM UTC, comment #5: 

If I run the script with 'echo on', the error occurs at line 45, the first call to zp2tf, which may have something to do with the error.

The zp2tf function instantiates a temporary tf object and calls tfdata on it. This is in addition to the 'tf' object 'SYS_c' that already exists at the script top level.

The crash trace involves the following on my system

#50 0x00007f8e652ae329 in octave::tree_statement_list::accept (tw=..., this=<optimized out>) at ../libinterp/parse-tree/pt-stmt.h:190
#51 octave_user_function::call (this=0x7f8e08564270, tw=..., nargout=1, _args=...) at ../libinterp/octave-value/ov-usr-fcn.cc:652
#52 0x00007f8e6533a43d in octave::feval (fcn=0x7f8e08564270, args=..., nargout=nargout@entry=1) at libinterp/parse-tree/oct-parse.yy:5229
#53 0x00007f8e651daf22 in octave_class::size (this=0x7f8e085c3f90) at ../libinterp/octave-value/ov-class.cc:311
#54 0x00007f8e65ecf65f in octave_value::size (this=0x7fff7b39ebe0) at ../libinterp/octave-value/ov.h:410
#55 octave::workspace_model::update_table (this=0x558236c4e820) at ../libgui/src/workspace-model.cc:298

where the object whose size is being evaluated is a 'tf' object.

Mike Miller <mtmiller>
Project Administrator
Thu 02 Aug 2018 07:11:54 PM UTC, comment #4: 

I see, sorry for jumping to the wrong conclusion. I do see a crash if I run the attached script in the GUI on Debian.

The backtrace shows that the workspace_model is trying to update its internal state while the script is running, the crash seems to occur somewhere in there.

Hiding the workspace panel doesn't fix this. But the crash does not occur with octave-gui running in non-GUI mode.

The crash also does not occur if I 'dbstop final_test_case' and then 'dbstep' through each line in the script individually.

Mike Miller <mtmiller>
Project Administrator
Thu 02 Aug 2018 06:44:43 PM UTC, comment #3: 

What I posted on maint list is different.
I can reproduce OP problem running attached script.
It finishes fine on cli version and crashes gui.

After that I recompiled octave with debugging options and discover
the problem I posted on maint list.


Dmitri A. Sergatskov <dasergatskov>
Thu 02 Aug 2018 06:42:19 PM UTC, comment #2: 

Dmitri - I doubt you are reproducing a crash on Windows on your Fedora system. The message you posted on the maintainers list is about a segmentation fault on exit. That has nothing to do with this report.

Let's keep this bug report on topic, GUI is crashing on Windows for Charles when performing some operations that have to do with plotting.

Charles - the random error messages you pasted here all seem to have to do with the 'error' name being referenced as a variable instead of a function. Do you declare a variable named 'error' anywhere in your scripts or functions?

Mike Miller <mtmiller>
Project Administrator
Thu 02 Aug 2018 04:53:26 PM UTC, comment #1: 

I can reproduce this problem on linux.
The backtrace 9as captured by system-coredump) is attached.


(file #44691)

Dmitri A. Sergatskov <dasergatskov>
Thu 02 Aug 2018 03:50:52 PM UTC, original submission:  

Appended code produces Octave crashes on windows.

Octave 4.4.1-rc1 and v4.4.0 and possibly older versions.

Sometimes everything is ok.

Sometimes octave crashes and ends.

Sometimes octave crashes at the first run. Sometimes after the 10. run. Just press F5 several times...

Sometimes octave crashes with a message from windows : octave-gui.exe has stopped working.

Crashes are more frequent when using gnuplot or fltk graphic toolkit.

Crashes seem to happen only with GUI (I could not produce a crash with CLI).

Sometimes some errors (as shown below) at random position but always after or at line 98:

    error: bool cannot be indexed with {
    error: parse error
    error: called from
        size at line 57 column 5
        findobj at line 249 column 13
        findall at line 45 column 7
        legend at line 989 column 15
        C:/tmp_tmp/02_test_case.m at line 98 column 1

    error: Invalid call to strcmpi.  Correct usage is:

     -- strcmpi (S1, S2)
    error: parse error
    error: called from
        print_usage at line 91 column 5
        size at line 76 column 13
        findobj at line 182 column 14
        findall at line 45 column 7
        legend at line 989 column 15
        C:/tmp_tmp/02_test_case.m at line 98 column 1

    error: parse error
    error: called from
           _adjust_tf_data_ at line 72 column 5
           tf at line 237 column 23
           _sys2tf_ at line 67 column 12
           tf at line 193 column 16
           tfdata at line 62 column 9
           _c2d_ at line 80 column 18
           c2d at line 84 column 7
           _time_response_ at line 125 column 7
           step at line 74 column 10
           C:/tmp_tmp/02_test_case.m at line 107 column 1

    error: delimiter(0): subscripts must be either integers 1 to (2^31)-1 or logi
    error: called from
        strjoin at line 72 column 20
        legend at line 638 column 11
        _03_test_case at line 98 column 1

Charles Praplan <charprap>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #44691:  coredump.txt added by dasergatskov (35KiB - text/plain)
file #44688:  final_test_case.m added by charprap (2KiB - application/octet-stream)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Updated the item)
  • -email is unavailable- added by charprap (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.





    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-03 mtmiller StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2018-09-19 mtmiller Carbon-CopyRemoved 80942 -
    2018-09-17 mtmiller Release4.4.1-rc1 4.4.1
    2018-09-17 mtmiller SummaryGUI crashes in execution of script using control tf objects GUI crashes on workspace refresh while executing script
    2018-09-17 mtmiller Dependencies- bugs #54656 is dependent
    2018-08-02 mtmiller Item GroupNone Segfault, Bus Error, etc.
        StatusNeed Info Confirmed
        SummaryOctave gui crashes (possibly graphic problem) GUI crashes in execution of script using control tf objects
    2018-08-02 mtmiller StatusNone Need Info
    2018-08-02 dasergatskov Attached File- Added coredump.txt, #44691
    2018-08-02 charprap Attached File- Added final_test_case.m, #44688

    Back to the top

    Powered by Savane 3.9