bugGNU Octave - Bugs: bug #50795, octave-gui hangs on exit


bug #50795: octave-gui hangs on exit

Submitter:  theirix <theirix>
Submitted:  Thu 13 Apr 2017 01:11:13 PM UTC
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Duplicate Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Fri 16 Feb 2018 03:23:22 PM UTC, comment #2: 

(This is a general reference-style comment)

I haven't looked at the code yet, but generally speaking the primary reason to derive from `QThread` should be to make it a RAII class, i.e. to have something like:

MyThread::~MyThread() {

A RAII class is generally always-destructible, and is used to control the resource's lifetime by extension. A `QThread` is three statements short of that requirement :). `MyThread` can always be safely destructed, as long as the code that runs in it behaves "sanely".

Such a thread can be owned by the main thread, and it will do the "right thing", i.e. not have UB, as long as a few precautions are taken.

The thread's default implementation of `run()` spins an event loop. Whatever runs inside the thread shouldn't block - since it will by extension block `wait()` from the thread-owning thread.

Qt's idiom for "do some work continuously" is a zero-duration timer. Ideally, octave's "main" code could be invoked in such an inverted-control fashion, i.e. it would have a `doWorkChunk()` entry point. That's how most async code has to work these days anyway.

As a fallback, the "main" could have locus of control, and invoke a callable to check whether it should return control. This callable would simply return `QThread::currentThread()->isInterruptionRequested()`. This can be done by reimplementing `MyThread::run()`, or using the  run-in-a-thread construct to start the interpreter there.

I have to take a look and see if this is in the "easy fix" category - this code does not have to be buggy or behave "strangely". Unfortunately, Qt documentation doesn't always make it obvious how things should be done so that they work OK.

Having the `fprintf` hack means that the bug is still there :(

Kuba Ober <kubao>
Thu 27 Apr 2017 08:18:44 PM UTC, comment #1: 

This looks like a duplicate of bug #50025, closing. Can you copy these attachments to that bug report?

Mike Miller <mtmiller>
Group Member
Thu 13 Apr 2017 01:11:13 PM UTC, original submission:  

Octave-GUI hangs on quit almost each time I launched it. Only kill -9 helps.

Stacktraces and spindumps are attached.

Octave was installed on macOS 10.12.4. Binary was obtained in homebrew with the following options:
/usr/local/Cellar/octave/4.2.1_1 (2,276 files, 47.2MB) *
  Poured from bottle on 2017-03-12 at 15:20:53
From: https://github.com/Homebrew/homebrew-science/blob/master/octave.rb
==> Dependencies
Build: gnu-sed ✔, pkg-config ✔, bison ✘, gawk ✔, texinfo ✔
Required: fontconfig ✔, freetype ✔, pcre ✔, veclibfort ✔, pstoedit ✔
Recommended: arpack ✔, curl ✔, epstool ✔, fftw ✘, fltk ✔, gl2ps ✔, glpk ✔, graphicsmagick ✔, hdf5 ✔, qhull ✔, qrupdate ✔, readline ✔, suite-sparse ✔, transfig ✔, ghostscript ✘, qt@5.7 ✔, gnuplot --with-qt@5.7 ✔
Optional: openblas ✘, libsndfile ✘, llvm ✘, portaudio ✘

theirix <theirix>


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

Attach Files:

Attached Files
file #40388:  Sample of octave-gui.txt added by theirix (58KiB - text/plain)


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by kubao (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by theirix (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-27 mtmiller Dependencies- Depends on bugs #50025
    2017-04-27 mtmiller StatusNone Duplicate
        Open/ClosedOpen Closed
    2017-04-13 theirix Attached File- Added Sample of octave-gui.txt, #40388
        Attached File- Added octave-gui_2017-04-13-153829_tau.hang.txt, #40389

    Back to the top

    Powered by Savane 3.12