bugGNU Octave - Bugs: bug #62515, Crash on exit if directory for...

 
 

bug #62515: Crash on exit if directory for history doesn't exist

Submitter:  Muhali <muhali>
Submitted:  Tue 24 May 2022 11:31:39 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Duplicate Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  8.1.0 Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 16 Jan 2023 04:49:00 PM UTC, comment #12: 

That should be fixed on the current stable branch with the following change:
https://hg.savannah.gnu.org/hgweb/octave/rev/6a5e4ef80a95

Closing as duplicate of bug #62365.

Markus Mützel <mmuetzel>
Group administrator
Fri 13 Jan 2023 08:11:52 PM UTC, comment #11: 

Can confirm same behavior on Arch Linux. Occurs if XDG_DATA_HOME points to a directory which does not exist.

Glenn Golden <grepfor>
Sat 02 Jul 2022 11:16:38 AM UTC, comment #10: 

Sorry. Misunderstood comment #8.
Re-titling to reflect the recent information

Markus Mützel <mmuetzel>
Group administrator
Sat 02 Jul 2022 11:14:00 AM UTC, comment #9: 

The first comment wasn't specific to which platform it applies. The later comments hint that this is an issue on Mac OS X (or whatever that OS is called currently).

IIUC, XDG_CONFIG_HOME and XDG_DATA_HOME aren't set (at least by default) on that platform. The fallbacks that Octave is using in that case don't seem to match Apple's recommendations:
https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html#//apple_ref/doc/uid/TP40010672-CH10-SW1

We currently use XDG_DATA_HOME to store the history. We use XDG_CONFIG_HOME for things like `.octaverc` or the GUI settings.
If I understand Apples recommendations correctly, better fallbacks for both for that platform would be "~/Library/Application Support".
However, I've never actually worked with that OS. So, please let me know if different fallbacks would be better.

I'm attaching a tentative patch that uses that fallback on that platform.
IIUC, that would fix the issue on Mac OS X.

An "actual" fix for all platforms might involve creating those directories recursively (not sure how to do that in a cross-platform compatible way) if they don't exist. (Maybe we should do that when those paths are requested?)
That is assuming that the original report is also caused by a missing directory...

(file #53389)

Markus Mützel <mmuetzel>
Group administrator
Fri 01 Jul 2022 11:49:24 AM UTC, comment #8: 


comment #7:

> mkdir -p ~/.local/share
> 5. octave-cli
> 6. exit
> INFO: exits OK
> INFO: now the file ~/.local/share/octave/history is created


perfect.

Muhali <muhali>
Fri 01 Jul 2022 11:09:27 AM UTC, comment #7: 

I am on macOS Catalina. The workaround for me is to create the folder ~/.local/share.

Steps to reproduce:
1. If the folder ~/.local/share exists, move it to Trash
2. octave-cli
3. exit
INFO: error: ignoring const execution_exception& while preparing to exit
4. If the folder "share" is in Trash, move it back to ~/.local/. If the folder "share" never existed, create it:
mkdir -p ~/.local/share
5. octave-cli
6. exit
INFO: exits OK
INFO: now the file ~/.local/share/octave/history is created

ptoshkov
Tue 14 Jun 2022 09:59:39 AM UTC, comment #6: 

The same issue happens when running octave-cli on a Mac (Monterey, OS 12.4):

% octave-cli
GNU Octave, version 7.1.0
Copyright (C) 1993-2022 The Octave Project Developers.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type 'warranty'.

Octave was configured for "x86_64-apple-darwin21.3.0".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> exit
error: ignoring const execution_exception& while preparing to exit

Jorge Diaz del Rio <jdiazdelrio>
Tue 24 May 2022 02:28:06 PM UTC, comment #5: 

here is the gdb output:

(gdb) where
#0  0x00007f84af7e0142 in __cxxabiv1::__cxa_throw (obj=0x7f84901eb690, tinfo=0x7f84b8524f58 <typeinfo for octave::exit_exception>, dest=0x7f84b7563df0 <octave::exit_exception::~exit_exception()>)
    at /home/user/.spack/stage/spack-stage-gcc-11.2.0-bcn7mbukxn2to7fet7ardakbntpa5zaf/spack-src/libstdc++-v3/libsupc++/eh_throw.cc:78
#1  0x00007f84b6f6827f in octave::interpreter::quit (this=<optimized out>, exit_status=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>,
    force=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, confirm=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>)
    at /opt/spack/gcc-11.2.0-bcn7mb/include/c++/11.2.0/bits/exception.h:63
#2  0x00007f84b788e4f4 in octave::Fquit (interp=..., args=...) at ../libinterp/corefcn/interpreter.cc:230
#3  0x00007f84b73bc6ab in octave_builtin::execute (this=0x7f849008c9c0, tw=..., nargout=0, args=...) at ../libinterp/octave-value/ov-builtin.cc:65
#4  0x00007f84b74182e8 in octave_function::call (this=this@entry=0x7f849008c9c0, tw=..., nargout=nargout@entry=0, args=...) at ../libinterp/octave-value/ov-fcn.cc:57
#5  0x00007f84b756c495 in octave::tree_identifier::evaluate_n (this=<optimized out>, tw=..., nargout=0) at /opt/spack/gcc-11.2.0-bcn7mb/include/c++/11.2.0/bits/atomic_base.h:634
#6  0x00007f84b7565499 in octave::tree_identifier::evaluate (this=<optimized out>, tw=..., nargout=<optimized out>) at ../libinterp/parse-tree/pt-id.h:98
#7  0x00007f84b756221d in octave::tree_evaluator::visit_statement (this=0x7f8490005cf8, stmt=...) at ../libinterp/parse-tree/pt-eval.cc:3781
#8  0x00007f84b754fe00 in octave::tree_statement::accept (tw=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>,
    this=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at ../libinterp/parse-tree/pt-stmt.h:124
#9  octave::tree_evaluator::visit_statement_list (this=0x7f8490005cf8, lst=...) at ../libinterp/parse-tree/pt-eval.cc:3866
#10 0x00007f84b7551687 in octave::tree_statement_list::accept (tw=..., this=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at ../libinterp/parse-tree/pt-stmt.h:201
#11 octave::tree_evaluator::eval (this=0x7f8490005cf8, stmt_list=..., interactive=<optimized out>) at ../libinterp/parse-tree/pt-eval.cc:984
#12 0x00007f84b755e631 in octave::tree_evaluator::repl (this=this@entry=0x7f8490005cf8) at ../libinterp/corefcn/interpreter.h:173
#13 0x00007f84b788cfcd in octave::interpreter::main_loop (this=this@entry=0x7f8490004ea0) at ../libinterp/corefcn/interpreter.cc:1340
#14 0x00007f84b78955b0 in octave::interpreter::execute (this=this@entry=0x7f8490004ea0) at ../libinterp/corefcn/interpreter.cc:908
#15 0x00007f84b8166b22 in octave::interpreter_qobject::execute (this=0xb99a00) at ../libgui/src/interpreter-qobject.cc:89
#16 0x00007f84b44fdf96 in QObject::event(QEvent*) () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#17 0x00007f84b5452d6f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Widgets.so.5
#18 0x00007f84b8185ea4 in octave::octave_qapplication::notify (this=0xadd140, receiver=<optimized out>, ev=<optimized out>) at ../libgui/src/octave-qobject.cc:146
#19 0x00007f84b44d10f8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#20 0x00007f84b44d42a6 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#21 0x00007f84b452aa13 in ?? () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#22 0x00007f84aa43561b in g_main_context_dispatch () from /opt/spack/glib-2.70.2-sj3rso/lib/libglib-2.0.so.0
#23 0x00007f84aa4358a8 in g_main_context_iterate.constprop () from /opt/spack/glib-2.70.2-sj3rso/lib/libglib-2.0.so.0
#24 0x00007f84aa43594f in g_main_context_iteration () from /opt/spack/glib-2.70.2-sj3rso/lib/libglib-2.0.so.0
#25 0x00007f84b452a084 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#26 0x00007f84b44cfb9b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#27 0x00007f84b42f067e in QThread::exec() () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#28 0x00007f84b42f16c0 in ?? () from /opt/spack/qt-5.15.2-34qtxj/lib/libQt5Core.so.5
#29 0x00007f84afb4914a in start_thread () from /lib64/libpthread.so.0
#30 0x00007f84aec84dc3 in clone () from /lib64/libc.so.6

Muhali <muhali>
Tue 24 May 2022 02:11:57 PM UTC, comment #4: 

After attaching gdb to the Octave process and having run all preparing commands at the (gdb) prompt, you'd need to continue the Octave process by executing `c` at the (gdb) prompt. After that, the (gdb) prompt should be irresponsive (until Octave's execution is stopped again) and Octave's prompt should be responsive again.

Markus Mützel <mmuetzel>
Group administrator
Tue 24 May 2022 01:57:16 PM UTC, comment #3: 


comment #1:

> This error always happens?  I don't see it.  Are you using the GUI?  Do you have to execute any commands or perform any actions with the GUI?  Or do you see it when just starting Octave and exiting?  How are you exiting?  Are you executing "quit" at the command prompt or closing the GUI window or something else?
>
> If you start Octave and then attach gdb to the executing process then execute
>


> catch throw


>
> at the (gdb) prompt you should be able to determine where the exception is thrown.  That should provide some clues.


After gdb is attached, octave is unresponsive, so I can't issue 'quit'. No GUI involved, simply starting 'octave -f' from the command line.

Is this perhaps related to

https://octave.discourse.group/t/problems-when-building-version-6-1-0-in-slackware-slackbuilds/953 ?

Muhali <muhali>
Tue 24 May 2022 12:43:15 PM UTC, comment #2: 

I get both of those if I do "sudo octave", I see the error message
on ARM platform for quite some time. I cannot reproduce any of those if I run octave normally on x86_64 linux.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Tue 24 May 2022 12:39:47 PM UTC, comment #1: 

This error always happens?  I don't see it.  Are you using the GUI?  Do you have to execute any commands or perform any actions with the GUI?  Or do you see it when just starting Octave and exiting?  How are you exiting?  Are you executing "quit" at the command prompt or closing the GUI window or something else?

If you start Octave and then attach gdb to the executing process then execute


catch throw


at the (gdb) prompt you should be able to determine where the exception is thrown.  That should provide some clues.

John W. Eaton <jwe>
Group administrator
Tue 24 May 2022 11:31:39 AM UTC, original submission:  

In a new build of octave (stable, hg id: a1476e3ea73d), two things occur:

a) there is no history available

b) when quitting, I get the message

error: ignoring const execution_exception& while preparing to exit

Debugging does not provide any additional hints.

Muhali <muhali>

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by grepfor (Posted a comment)
  • -email is unavailable- added by ptoshkov (Posted a comment)
  • -email is unavailable- added by jdiazdelrio (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by muhali (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-16 mmuetzel StatusNeed Info Duplicate
        Open/ClosedOpen Closed
        Fixed ReleaseNone 8.1.0
        Dependencies- Depends on bugs #62365
    2022-07-02 mmuetzel Operating SystemGNU/Linux Any
        Summaryerror: ignoring const execution_exception&amp; while preparing to exit Crash on exit if directory for history doesn't exist
    2022-07-02 mmuetzel Attached File- Added bug62515-XDG-fallback-on-mac.patch, #53389
        CategoryNone Interpreter
        Item GroupNone Segfault, Bus Error, etc.
    2022-05-24 jwe StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code