bugGNU Octave - Bugs: bug #40242, FLTK + GUI = crash on MacOSX

 
 

bug #40242: FLTK + GUI = crash on MacOSX

Submitted by:  Ben Abbott <bpabbott>
Submitted on:  Fri Oct 11 14:58:39 2013  
 
Category: GUISeverity: 4 - Important
Priority: 5 - NormalItem Group: Crash
Status: Wont FixAssigned to: None
Originator Name: Ben AbbottOpen/Closed: Closed
Release: devOperating System: Mac OS

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Fri Nov 27 01:51:53 2015, comment #18:

I'm mark as "Wont Fix" and close it.

Ben Abbott <bpabbott>
Project Member
Thu Nov 26 05:16:01 2015, comment #17:

Is this bug still relevant? I believe Mac OSX users can now use the qt toolkit which means things have improved dramatically since the reporting of this bug 2 years ago.

Rik <rik5>
Project Administrator
Thu Jan 16 17:09:31 2014, comment #16:

Here's a closed duplicate bug with a screen shot and some crash dumps if that weill be helpful to anyone working on this.

Since I can't debug this myself, and I'm comfortable sticking with gnuplot for now, you'll get no further drumbeat from me. But if there is anything concrete I can offer to help illuminate the problem, let me know.

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

Michael C. Grant <mcgrant>
Mon Nov 18 01:34:16 2013, comment #15:

If the problem is really what I think it is, meaning OS X does not allow any GUI interaction outside the main thread, then indeed I don't see an immediate solution. By design, it can't work.

Michael Goffioul <goffioul>
Project Member
Sun Nov 17 22:52:37 2013, comment #14:

Does Michael's comment indicate that there is no possible resolution of this for the 3.8.0 release?

Rik <rik5>
Project Administrator
Sun Nov 17 18:53:04 2013, comment #13:

The FLTK backend for octave is designed to run synchronously with the octave interpreter (using the readline event loop); hence it is running in the octave thread.

This is probably a fundamental problem when using the octave GUI, where octave interpreter is not running in the main thread. Mac OS X platform is much more strict (less flexible) in that regard and I believe any GUI interaction must occur in the GUI thread, and must be the main thread.

QtHandles design is different and run the GUI in a separate thread than octave; when a GUI thread (containing the QApplication object) already exists, it hooks up to that GUI thread. Interaction between octave and the GUI is done using non-blocking signal/slot mechanism. This difference in design is why QtHandles works with the GUI in Mac OS X.

Michael Goffioul <goffioul>
Project Member
Sun Nov 17 16:24:39 2013, comment #12:

>> ... Correct?


That is indeed how I understand it.

>> the proper place?


I don't know if DEFUN functions such as _init_fltk_ can be run out of the interpreter thread (maybe with the new Ffunction mechanism to run DEFUN from C++) but if so it would be worth trying.

Pantxo Diribarne <pantxo>
Project Member
Sun Nov 17 16:02:31 2013, comment #11:

Opps ... sorry, I mis-interpreted your prior comment.

Is the main thread for the GUI and the CLI the same? I haven't looked at the code, but my impression is that the octave-gui's ,main thread is the GUI thread, and that octave-cli's main thread is the interpreter. Correct?

Will the interpreter and GUI threads need an if-then-else block on MacOS X to check if the GUI or CLI is running to ensure the toolkit is instantiated in the proper place?

Ben Abbott <bpabbott>
Project Member
Sun Nov 17 14:53:38 2013, comment #10:

AFAIU, the GUI (not the interpreter) thread is currently the main thread.

I tried to modify octave-gui.cc, and replace QCoreApplication by QApplication in the no-gui section, and "qt" graphics_toolkit now works in "--no-gui" mode also. This means instantiating qt toolkit from the interpreter thread works as soon as QApplication context has been launched from the GUI thread.

If the instantiation of qt/fltk graphic toolkits could be moved to the GUI thread, it would probably solve the problem for fltk indeed.

Pantxo Diribarne <pantxo>
Project Member
Sun Nov 17 14:19:11 2013, comment #9:

The GUI thread must be the main thread (interpreter?) on Mac OS X. Thus, I think the instantiation of qt is what needs to be moved.

Ben Abbott <bpabbott>
Project Member
Sun Nov 17 11:17:08 2013, comment #8:

I have installed QtHandles graphics_toolkit on mac os 10.7 :
- it works just fine with the gui
- crashes with --no-gui ("QWidget: Cannot create a QWidget when no GUI is being used"). This is due to using a QCoreApplication instead of a QApplication in --no-gui mode.
- in cli mode, graphics_toolkit ("qt") returns an error as no QApplication has been initiated.

That tends to make me second Ben interpretation. Even though the figures may be launched from the interpreter thread they use the QApplication context that was instantiated from the main GUI thread. In the case of FLTK the initialization of the GUI is made from the interpreter thread.

Is it possible to Initialise FLTK from the GUI thread (which would make 2 GUI toolkits in the same thread)?

Pantxo Diribarne <pantxo>
Project Member
Tue Oct 22 23:41:26 2013, comment #7:

Yes, I have Xcode. After googling about, it appears that Processor.prefPane and hwprefs are part of MacOS 10.5. I'm running MacOS 10.7.5

In any event, I tried the approach you linked to. I turned off hardware multi-threading and set the number of cores to 1. I still encountered the crash.

Ben Abbott <bpabbott>
Project Member
Tue Oct 22 23:14:30 2013, comment #6:

Do you have Xcode installed? Also, this article is new and suggests another way of limiting the cores that are running http://jesperrasmussen.com/blog/2013/03/07/limiting-cpu-cores-on-the-fly-in-os-x-mountain-lion/

Rik <rik5>
Project Administrator
Tue Oct 22 21:21:23 2013, comment #5:

Rik,

I'm not good at interpreting the crash log, but my recollection is that MacOS X requires the gui to run on the main thread. Is the main thread "0" and is FLTK running there?

Ben Abbott <bpabbott>
Project Member
Tue Oct 22 21:03:10 2013, comment #4:

I haven't been able to locate the file "Processor.prefPane", and the command "hwprefs cpu_ht=false" doesn't work as there is no "hwprefs" in my path.

Ben Abbott <bpabbott>
Project Member
Tue Oct 22 20:19:30 2013, comment #3:

This is going to be pretty hard to debug. One thought from the crash log is that the drawnow() is called in thread #6 and halts on a lock while thread #0 goes on to segfault. Is there a way to disable multi-threading? I don't know if the FLTK libraries are re-entrant and that could be the problem. I saw this post about disabling hyperthreading (http://superuser.com/questions/467950/how-to-disable-hyperthreading-on-mac-os-x-lion). You might try it and see if (1) it still crashes, and (2) whether there is now only a single thread running when it does. There are other threading mechanisms besides hyperthreading which might need to be turned off as well

Rik <rik5>
Project Administrator
Tue Oct 22 18:09:09 2013, comment #2:

Still crashes. The crash log is attached.

(file #29444)

Ben Abbott <bpabbott>
Project Member
Tue Oct 22 17:59:56 2013, comment #1:

Can you run without any initialization files to make sure that this is a site-specific bug.

Rik <rik5>
Project Administrator
Fri Oct 11 14:58:39 2013, original submission:

I'm running MacOS 10.7.5 and am using Macports for all dependencies. From the gui, plotting with the FLTK toolkit causes Octave to crash. The crash log is attached.

Ben Abbott <bpabbott>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by mcgrant (Posted a comment)
  • -unavailable- added by goffioul (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by bpabbott (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Nov 27 01:51:53 2015bpabbottStatusNeed Info=>Wont Fix
      Open/ClosedOpen=>Closed
    Thu Nov 26 05:16:01 2015rik5StatusNone=>Need Info
    Thu Jan 16 16:54:31 2014jordighDependencies-=>bugs #41244 is dependent
    Tue Oct 22 18:09:09 2013bpabbottAttached File-=>Added octave_2013-10-22-140752_Bens-MacBook-Pro.crash, #29444
    Tue Oct 22 16:53:16 2013bpabbottSeverity3 - Normal=>4 - Important
    Fri Oct 11 14:58:39 2013bpabbottAttached File-=>Added octave_2013-10-11-105523_Bens-MacBook-Pro.crash, #29356

    Back to the top


    Powered by Savane 3.1-cleanup