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


bug #50795: octave-gui hangs on exit

Submitted by:  theirix <theirix>
Submitted on:  Thu 13 Apr 2017 01:11:13 PM UTC  
Category: GUISeverity: 3 - Normal
Priority: 5 - NormalItem Group: Unexpected Error
Status: DuplicateAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.2.1Operating System: Mac OS

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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:

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>
Project Administrator
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 File(s):

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
  • -unavailable- added by kubao (Posted a comment)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by theirix (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 27 Apr 2017 08:18:58 PM UTCmtmillerDependencies-=>Depends on bugs #50025
    Thu 27 Apr 2017 08:18:44 PM UTCmtmillerStatusNone=>Duplicate
    Thu 13 Apr 2017 01:11:13 PM UTCtheirixAttached 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.1-cleanup1