To Andrew and Orion:

I am handing off the octave-4 segfault issue that is described below
to you guys because I have run out of ideas and you both have more
octave/swig knowledge than I do.  There is a small bit at the end
where I solved all the valgrind reporting problems that were stopping
valgrind analysis, but the extremely simple run-time test of our
octave4 bindings still segfaults (presumably because the octave API
has changed significantly between octave 3 and octave 4), and I don't
know where to start to fix it because the full valgrind report
(attached as plplot_valgrind.out.gz) still isn't helping me very much.
But maybe one of you can figure it out or come up with an additional
octave option to make the valgrind results more useful for diagnosing
whatever the problem is that is causing the segfault.

More below.

On 2015-07-14 00:28-0700 Alan W. Irwin wrote:

On 2015-07-11 19:27-0700 Alan W. Irwin wrote:
[...Y]our build
success motivates me to expand the epa_build implementation to see how
far I can get with an epa_build of Octave-4.0.0 and patched versions
of swig-2 and swig-3.  Assuming I can epa_build all of those, then
that would allow me to do the above run-time check here for patched
versions of both swig-2 and swig-3, and thus help build the case to
get your swig patch (or two variants of that if your patch has to be
modified for swig-2) into the next official releases of both swig-2
and swig-3.

Hi Orion:

The current status of this effort is I am done with all the relevant
epa_build configuration, but the result segfaults at run time.

Here is what I have done so far.

1. Implemented an epa_build of lapack and blas.  ctest of that build
passed 100 per cent of all the many tests.

2. Upgraded the epa_build of swig-2.0.11 to swig-3.0.6 with your patch applied.
The result works well with PLplot for the non-octave case.  For
example, the swig-generated Python, Lua, and Java bindings all work
well.

3. Implemented an epa_build of octave_lite which is octave-4.0.0 with
all optional components disabled.  This version passes the simple test

octave:1> x=-pi:0.1:pi;
octave:2> plot(x,sin(x))
octave:3> exit

with the plot done with the default gnuplot.  However, valgrind of
that simple test loses control of octave_lite (see below).

4. epa_built plplot_lite against this octave-lite version with no issues.

5. However, when I try the above simple test in a directory which
contains the following file (to enable the PLplot version of plotting)

wine@raven> cat .octaverc
warning("off","Octave:shadowed-function");
addpath("/home/wine/newstart/build_script/build_dir-linux/epa_build/Source/build_plplot_lite/bindings/octave/PLplot","/home/wine/newstart/build_script/build_dir-linux/epa_build/Source/build_plplot_lite/bindings/octave/PLplot/support","/home/wine/newstart/build_script/build_dir-linux/epa_build/Source/build_plplot_lite/bindings/octave/misc","/home/wine/newstart/build_script/build_dir-linux/epa_build/Source/build_plplot_lite/examples/octave","/home/wine/newstart/build_script/build_dir-linux/epa_build/Source/comprehensive_test_disposeable/shared/build_tree/bindings/octave","/home/wine/newstart/build_script/build_dir-linux/epa_build/Source/comprehensive_test_disposeable/shared/build_tree/bindings/octave/PLplot");
global pl_automatic_replot
pl_automatic_replot=1;

where the form of this file has been suggested by bindings/octave/USAGE

the above simple plot test segfaults (where normally with PLplot built
against octave-3.x.y, this simple test generates a plot using the xwin device).

I would like to do further debugging of this segfault with valgrind,
but somehow valgrind is losing control of octave_lite so never
generates any messages after the normal burst of initial messages and
the commands go the same speed as usual (not the slow speed you
normally get with valgrind) regardless of whether I use gnuplot
(without segfault) or the .octaverc trick above to attempt to use
plplot (with segfault).

That issue had a simple solution; for valgrind to trace octave4 requires
the valgrind option --trace-children=yes.  However, that in turn shows
a very extensive call stack where the number of callers is much larger
than the typical limit of 50 for --num-callers used for older valgrind
versions like provided by Debian wheezy.  Thus, to access a recent
valgrind version that allows --num-callers=500 at maximum, I epa_built
valgrind-3.10.1 (as opposed to Debian wheezy's 3.7.0).  And I generated
valgrind results with the following (wrapped) command:

/home/wine/newstart/build_script/install-linux_buildtools/bin/valgrind
--num-callers=500 --trace-children=yes octave 2>| plplot_valgrind.out

where I did the above simple test of the epa_built octave-4.0.0 in the 
directory where the above
.octaverc existed.  The segfault occurs and valgrind (as you can see
from the attached plplot_valgrind.out.gz) detects a couple of invalid
reads that presumably caused that segfault.

If I do exactly the same test (except for output file named
gnuplot_valgrind.out in a directory without that .octaverc,
then no segfault occurs, gnuplot plots the plot, and the valgrind
result (attached as gnuplot_valgrind.out.gz) is clean

However, I cannot proceed further than that because
plplot_valgrind.out.gz appears to contain no references to PLplot at
all. So I am completely stuck and handing off to you guys.

In any case, getting PLplot ready for octave4 is obviously
post-release material so my plan for the forthcoming release of 5.11.1
is the -DTRY_OCTAVE4=ON cmake option will remain highly experimental,
and unless the user sets that option our build system will either find
and use octave3 or disable octave altogether.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

Attachment: plplot_valgrind.out.gz
Description: valgrind output for simple test of octave4 with PLplot

Attachment: gnuplot_valgrind.out.gz
Description: valgrind output for simple test of octave4 with gnuplot

------------------------------------------------------------------------------
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to