bugGNU Octave - Bugs: bug #56149, An HDF5 file which fails to load...


bug #56149: An HDF5 file which fails to load causes segfault when eventually exiting

Submitted by:  Rik <rik5>
Submitted on:  Wed 17 Apr 2019 03:39:29 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  5.1.0 Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

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


Tue 23 Apr 2019 10:59:01 PM UTC, comment #5: 

The problem was that Octave was calling error() within an HDF5 library function that was iterating over data elements.  The exception-based instant abort of error() was leaving the library function in a mangled state.  See https://hg.savannah.gnu.org/hgweb/octave/rev/eb25b491dad7.

Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Wed 17 Apr 2019 10:55:58 PM UTC, comment #4: 

Here is what I see:

octave:1> load example.h5
error: load: error while reading hdf5 item all_measurements
octave:1> quit

Thread 1 "octave-cli" received signal SIGSEGV, Segmentation fault.
0x00007ffff559cf27 in H5SL_search () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
(gdb) where
#0  0x00007ffff559cf27 in H5SL_search () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#1  0x00007ffff54a01c1 in H5FO_top_decr () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#2  0x00007ffff54b623d in H5G_close () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#3  0x00007ffff54b65e2 in H5G__close_cb () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#4  0x00007ffff54ea951 in ?? () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#5  0x00007ffff55a0ee3 in H5SL_try_free_safe () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#6  0x00007ffff54eb391 in H5I_clear_type () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#7  0x00007ffff54a93d3 in H5G_top_term_package () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#8  0x00007ffff53d025b in H5_term_library () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#9  0x00007ffff53d1a4d in H5close () from /usr/lib/x86_64-linux-gnu/libhdf5_serial.so.103
#10 0x00007ffff7a94d2b in octave::load_save_system::~load_save_system (this=0x5555555d0568, __in_chrg=<optimized out>) at /home/jwe/src/octave/libinterp/corefcn/load-save.cc:277
#11 0x00007ffff7a6ba1c in octave::interpreter::~interpreter (this=0x5555555cfcb0, __in_chrg=<optimized out>) at /home/jwe/src/octave/libinterp/corefcn/interpreter.cc:538
#12 0x00007ffff71adbc7 in octave::application::delete_interpreter (this=0x7fffffffd570) at /home/jwe/src/octave/libinterp/octave.cc:332
#13 0x00007ffff71adf5d in octave::cli_application::execute (this=0x7fffffffd570) at /home/jwe/src/octave/libinterp/octave.cc:393
#14 0x00005555555564ed in main (argc=8, argv=0x7fffffffd898) at /home/jwe/src/octave/src/main-cli.cc:92

Since the segfault happens inside an HDF5 library function, maybe we are failing to clean up properly after the error?  H5close is not closing a file, but is intended to free resources used by the HDF5 library.

John W. Eaton <jwe>
Project Administrator
Wed 17 Apr 2019 10:02:49 PM UTC, comment #3: 

My guess is that there is something wrong with the way we trap errors when reading from files.  It appears to be okay, in that Octave returns to the prompt, but when Octave finally exits there is the segfault.  It may be that the error is trapped, but not cleared.  Then at the end of the program Octave is restoring the trap handlers and comes across a lingering error.

Rik <rik5>
Project Administrator
Wed 17 Apr 2019 07:30:26 PM UTC, comment #2: 

I can confirm this with Octave-6.0.0 on Windows.

Note that my cross-build has patch #8607 in the build. Could the fact that that makes no difference to the behavior here give a clue?

Philip Nienhuis <philipnienhuis>
Project Member
Wed 17 Apr 2019 03:55:46 PM UTC, comment #1: 

This also happens with the CLI version of Octave.

Rik <rik5>
Project Administrator
Wed 17 Apr 2019 03:39:29 PM UTC, original submission:  

This is simple to reproduce, but pretty weird.  Use the file example.h5 attached to this bug report and then try

run-octave -f
load example.h5
error: load: error while reading hdf5 item all_measurements
fatal: caught signal Segmentation fault -- stopping myself...
Segmentation fault (core dumped)

This behavior has been present, but buried, for a long time because I find the same behavior back through at least version 4.2.1.

Rik <rik5>
Project Administrator


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

Attach Files:

Attached Files
file #46785:  example.h5 added by rik5 (36KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)

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

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-23 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
        Releasedev => 5.1.0
    2019-04-17 rik5 StatusNone => Confirmed
    2019-04-17 rik5 Attached File- => Added example.h5, #46785

    Back to the top

    Powered by Savane 3.7