bugGNU Octave - Bugs: bug #50210, octave-gui crashes on exit

 
 

bug #50210: octave-gui crashes on exit

Submitter:  Elvis Angelaccio <eang>
Submitted:  Thu 02 Feb 2017 06:35:42 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 15 Sep 2017 03:26:46 PM UTC, comment #7: 

Thanks for testing.  I'm going to close the report.

Rik <rik5>
Group administrator
Fri 15 Sep 2017 01:44:37 PM UTC, comment #6: 

I can't reproduce anymore with octave 4.2.1. The archlinux package also applies this patch [1] but I'm not sure if that's relevant.

[1]: http://hg.savannah.gnu.org/hgweb/octave/raw-rev/16fae04366b2

Elvis Angelaccio <eang>
Tue 05 Sep 2017 05:05:12 AM UTC, comment #5: 

Do things work now?  I see that jwe just checked in another attempt


changeset:   24001:8e4abfaadd97
user:        John W. Eaton <jwe@octave.org>
date:        Mon Sep 04 13:55:14 2017 -0400
summary:     attempt better cleanup of Octave interpreter thread in GUI



Rik <rik5>
Group administrator
Sat 02 Sep 2017 04:02:30 AM UTC, comment #4: 

I'm referencing previous work on the exit sequence:

https://savannah.gnu.org/bugs/?44485

I believe I tried something similar to what is done here, i.e., terminate and wait, but that wasn't quite right.  Octave core wasn't exiting properly and would cause an error message at the command line at exit...and wait() had some issues too, but I can't remember them right now.  One thing was as pointed out in the patch:


+  // FIXME: should there be a limit on how long we wait?
+  m_main_thread->wait ();


The way I had approached this is to start a Qt timer and connect it to the signal expected to come from Octave core.  If that signal didn't arrive by time the timer expired, then it would toss up a dialog and ask if the thread should be terminated.  It's tricky in the sense that the signal could arrive while the dialog box is up.  Or the user could impatiently press "exit" multiple times, so we had to make sure to not put up multiple dialog boxes to confirm forced-terminate.  It all worked fairly well, but I was never quite happy that every scenario was covered in a robust way so after a few days I decided to let it sit.

Part of the reason I suspended work on that is, if I recall correctly, the Cnrtl-C handling wasn't worked out very well.  I thought the Cntrl-C would be the way to break out of a busy Octave core command.  At the time, the only way to terminate Octave core was to send an "exit" command.  Of course, if Octave is busy processing, it may be a long time, if ever, before the process finishes and the "exit" is handled.  So, I guess I was waiting to see how the SIGABRT evolved before putting a close-but-not-quite exit routine in the GUI.

Dan Sebald <sebald>
Thu 31 Aug 2017 08:48:14 PM UTC, comment #3: 

I checked in this changeset on default:

http://hg.savannah.gnu.org/hgweb/octave/rev/fb9b024a6041

It seems to fix the problem for me.

Maybe I should have made this change on stable?  Hmm.

John W. Eaton <jwe>
Group administrator
Thu 16 Mar 2017 07:09:22 PM UTC, comment #2: 

This issue occurs with Qt 5.8.0 because the error message

QThread: Destroyed while thread is still running

is now emitted by qFail() instead of qWarning(). It means that now Qt issues a SIGABRT that is caught by octave.

The following patch works for me:


--- origsrc/octave-4.2.0/libgui/src/octave-qt-link.cc
+++ src/octave-4.2.0/libgui/src/octave-qt-link.cc
@@ -68,6 +68,8 @@ octave_qt_link::octave_qt_link (QWidget
 octave_qt_link::~octave_qt_link (void)
 {
   delete command_interpreter;
+  main_thread->terminate ();
+  main_thread->wait ();
   delete main_thread;
 }


Anonymous
Wed 08 Feb 2017 08:59:00 PM UTC, comment #1: 

The error message from Qt appears in the backtrace you attached:

> QThread: Destroyed while thread is still running


This indicates that the main_thread QThread object was destroyed but the thread had not yet exited. A full backtrace of all running threads at the time of the error might be helpful ("thread apply all backtrace" in gdb).

I am unable to reproduce on Debian with Qt 5.7.1

Mike Miller <mtmiller>
Group Member
Thu 02 Feb 2017 06:35:42 PM UTC, original submission:  

octave-gui crashes on exit on Archlinux systems. Happens (every time) on two different machines of mine, one with Qt 5.7.1 and the other one with Qt 5.8.0. Attached are backtrace and valgrind logs.

Elvis Angelaccio <eang>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #39708:  thread-all-backtrace.txt added by eang (7KiB - text/plain - Backtrace from all active threads)
file #39648:  octave-valgrind.txt added by eang (207KiB - text/plain - gdb backtrace and valgrind log)
file #39647:  octave-backtrace.txt added by eang (3KiB - text/plain - gdb backtrace and valgrind log)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by sebald (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by eang (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 group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-15 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2017-08-31 jwe StatusNeed Info Ready For Test
    2017-02-09 eang Attached File- Added thread-all-backtrace.txt, #39708
    2017-02-08 mtmiller StatusNone Need Info
    2017-02-02 eang Attached File- Added octave-backtrace.txt, #39647
        Attached File- Added octave-valgrind.txt, #39648

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code