octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #41699] imread causes a segmentation fault whe


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #41699] imread causes a segmentation fault when exiting Octave
Date: Mon, 21 Apr 2014 22:59:55 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36

Follow-up Comment #26, bug #41699 (project octave):

Ok, I now have an explanation for this bug, all I need is for you to confirm
that your segfault on Windows is due to OpenMP / libgomp by setting
OMP_NUM_THREADS=1 and confirming that the crash no longer happens.

The cause of the segfault looks to me to be because the image functions are
implemented in an oct-file. This oct-file links to the GraphicsMagick library,
which uses OpenMP. When Octave exits, it attempts to unload all oct-files that
were loaded during its execution. Unloading the oct-file for __magick_read__
causes the libgomp library to be unloaded since Octave is not using it for
anything else. If OpenMP threads were launched during the run, this causes a
segfault in one of the OpenMP threads because the library implementing them
has been unloaded from the process space.

I can reproduce this crash with a standard C main function calling dlopen to
load a plugin, which then does some simple OpenMP loop. Calling dlclose on the
plugin causes the same exact segfault.

One solution is to compile Octave with OpenMP enabled. This causes libgomp to
be linked with the Octave libraries and executables, and therefore it won't be
unloaded when the oct-file is unloaded. This seems like a good solution,
especially if users may implement their own oct-files that use OpenMP, which
may then cause a crash when the oct-files are unloaded.

Another solution is to compile GraphicsMagick without OpenMP (--disable-openmp
to GraphicsMagick's configure). This might work for the MXE build, but we
can't control this for Linux distros or other packaging systems. This also
does not solve the point about users wanting to write oct-files using OpenMP.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41699>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]