P.S. Fixing the fifo bug had no impact on the segfault with 
USE_TCL_TK_STUBS=ON.

One other issue I encountered was that detecting of the various tcl 
components is not entirely robust. I had tcl8.5 and tcl8.6 installed.
On Ubuntu the default is tcl8.5 so tclsh points to tclsh8.5. This 
means that most of the tcl-related variables were set to point to 8.5,
however the code setting TCL_INCLUDE_PATH ended up pointing to tcl8.6. 
This is probably a cmake issue rather than a plplot issue, but I
thought I'd flag it up.

Andrew 

On Wed, Dec 18, 2013 at 09:54:48PM +0000, Andrew Ross wrote:
> Alan,
> 
> Out of interest I tried installing tcl / tk 8.6 from Ubuntu and 
> building with that using -DUSE_TCL_TK_STUBS=ON. I can confirm the bug 
> exists in that case too. No need to use epa_build. I've not (yet) 
> gone back to check on 8.5
> 
> I tried running the example through valgrind and with gdb, but there 
> is nothing very helpful beyond what you've already identified. It is
> definitely a stubs related issue. Without -DUSE_TCL_TK_STUBS=ON I see no 
> segfault.
> 
> I also tried adding -fstack-protector-all to CFLAGS, but nothing 
> showed up.
> 
> This is something of a mystery, and I must admit I don't know enough 
> about tcl / tk to speculate on that.
> 
> Incidentally you are right about the first two entries in the valgrind 
> log. This is a result of my recent changes to clean up the fifo creation
> code. I've fixed this particular bug anyway.
> 
> Andrew
> 
> 
> On Thu, Dec 12, 2013 at 10:13:26PM -0800, Alan Irwin wrote:
> > I have tagged the subject line with [Post-release] because I think it
> > is too late for for any but the most obvious and simple changes in
> > this release cycle, but I hope some of the memory management issues
> > that I am discovering right now for the tk device driver will be
> > addressed right away in the next release cycle.
> > 
> > I have discovered through the comprehensive tests of epa_build results
> > that I just implemented that examples/c/x01c -dev tk (and presumably
> > the rest of the C examples) segfault under a certain combination of
> > circumstances.
> > 
> > (1) Must be using the version of Tcl/Tk(8.6) built by epa_build.
> > 
> > (2) Must have -DUSE_TCL_TK_STUBS=ON
> > 
> > I know I did tests for this exact combination of circumstances in the
> > very recent past (via the test_interactive target which definitely
> > runs examples/c/x01c -dev tk and a lot of other tests) without a
> > segfault.  However, that is the nature of memory management issues;
> > some times you get segfaults and sometimes you don't.
> > 
> > When I ran valgrind on examples/c/x01c -dev tk for the above
> > combination of circumstances it showed an invalid read followed by a
> > segfault occurred at line 712 of bindings/tcl/tclAPI.c;
> > 
> > Tcl_SetVar( interp, "dir", TCL_DIR, TCL_GLOBAL_ONLY );
> > 
> > The TCL_DIR macro has not been clobbered according to the debug
> > 
> > fprintf( stderr, "adding %s to auto_path\n", TCL_DIR );
> > 
> > that occurs (now) just before that statement, and everything else
> > about this statement is pretty simple and benign so I don't understand
> > at all what is causing this segfault.  But it is a virtual certainty
> > it is caused by something being overwritten either in the heap or
> > stack.
> > 
> > Since -DUSE_TCL_TK_STUBS=ON is a new innovation that is not as well
> > tested as our traditional Tcl, etc., results which did not
> > use the stubs Tcl/Tk libraries, I have decided to work around
> > this issue for the default case by adopting -DUSE_TCL_TK_STUBS=OFF for
> > that case.
> > 
> > I then looked carefully at the -DUSE_TCL_TK_STUBS=OFF case with a
> > valgrind run on examples/c/x01c -dev tk.  For this non-stubs case
> > there were no obvious issues like invalid reads, but there were a fair
> > number of fouled up memory allocations by the time the example was
> > done as you can see from the attached valgrind report. Some of those
> > (such as at least the first two) are definitely due to PLplot code and
> > should be addressed by us post release just in case one of those is
> > the culprit that indirectly causes the invalid read and segfault
> > issues for the stubs case.
> > 
> > Of course, the issue might also be that PLplot can reliably use the
> > Tcl/Tk stubs libraries for Tcl/Tk version 8.5, but not 8.6 because of
> > our extensive use of of Tcl/Tk library API which has been deprecated
> > for many releases of Tcl/Tk and which therefore might not be reliably
> > maintained any more by the Tcl/Tk developers (say as of version 8.6).
> > 
> > @Arjen: To avoid such Tcl/Tk potential internal bit-rot issues, I
> > would strongly encourage you (post-release) to establish some minimum
> > Tcl/Tk version we support (8.5?) and review all our Tcl/Tk code and
> > systematically replace Tcl/Tk API calls that were deprecated as of
> > that version with the recommended replacements.  That's worth
> > doing in its own right and may have some impact on the memory
> > management issues I have discovered.
> > 
> > I am bringing up these tk device driver memory management issues because
> > they are fresh in my mind, but I emphasize again they should only be
> > tackled post-release.
> > 
> > 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
> > __________________________
> 
> 
> > ------------------------------------------------------------------------------
> > Rapidly troubleshoot problems before they affect your business. Most IT 
> > organizations don't have a clear picture of how application performance 
> > affects their revenue. With AppDynamics, you get 100% visibility into your 
> > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics 
> > Pro!
> > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> 
> > _______________________________________________
> > Plplot-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/plplot-devel
> > 
> > --8323328-1055011482-1386915207
> 
> 
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT 
> organizations don't have a clear picture of how application performance 
> affects their revenue. With AppDynamics, you get 100% visibility into your 
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Plplot-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/plplot-devel

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to