Hi Arjen:

I took a look at the segfault that was occurring at the end of running
the test_wish_standard_examples target.  The segfault persisted even if
I eliminated running all examples, and finally I discovered that
the "plframe .plw" command (part of tkdemos.tcl that is
executed in the wish case) was the crux of the issue.  So here
is the simplest test case:

software@raven> wish
% lappend auto_path /home/software/plplot_svn/HEAD/build_dir/bindings/tk
/usr/share/tcltk/tcl8.5 /usr/lib /usr/local/lib/tcltk /usr/local/share/tcltk 
/usr/lib/tcltk /usr/share/tcltk /usr/share/tcltk/tk8.5 
/usr/share/tcltk/tk8.5/ttk /home/software/plplot_svn/HEAD/build_dir/bindings/tk
% package require Pltk
5.9.10
% plframe .plw
.plw
% exit
Segmentation fault

If I don't run the "plframe .plw" command, exit produces no segfault (as
expected).

Here are the corresponding valgrind results.

software@raven> valgrind wish
==27948== Memcheck, a memory error detector
==27948== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et
al.
==27948== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
info
==27948== Command: wish
==27948== 
% lappend auto_path /home/software/plplot_svn/HEAD/build_dir/bindings/tk
/usr/share/tcltk/tcl8.5 /usr/lib /usr/local/lib/tcltk /usr/local/share/tcltk 
/usr/lib/tcltk /usr/share/tcltk /usr/share/tcltk/tk8.5 
/usr/share/tcltk/tk8.5/ttk /home/software/plplot_svn/HEAD/build_dir/bindings/tk
% package require Pltk
5.9.10
% plframe .plw
.plw
% exit
==27948== Use of uninitialised value of size 8
==27948==    at 0x54A2124: pthread_mutex_lock (pthread_mutex_lock.c:50)
==27948==    by 0x5701F96: XrmDestroyDatabase (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x56E9C39: _XFreeDisplayStructure (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x56D702E: XCloseDisplay (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x4E9238D: ??? (in /usr/lib/libtk8.5.so.0)
==27948==    by 0x4E761AD: ??? (in /usr/lib/libtk8.5.so.0)
==27948==    by 0x51ECEDD: Tcl_FinalizeThread (in
/usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ECDC7: Tcl_Finalize (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ECC59: Tcl_Exit (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51B5A9E: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ACDBD: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51EF4BD: ??? (in /usr/lib/libtcl8.5.so.0)
==27948== 
==27948== Invalid read of size 4
==27948==    at 0x54A2124: pthread_mutex_lock (pthread_mutex_lock.c:50)
==27948==    by 0x5701F96: XrmDestroyDatabase (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x56E9C39: _XFreeDisplayStructure (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x56D702E: XCloseDisplay (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x4E9238D: ??? (in /usr/lib/libtk8.5.so.0)
==27948==    by 0x4E761AD: ??? (in /usr/lib/libtk8.5.so.0)
==27948==    by 0x51ECEDD: Tcl_FinalizeThread (in
/usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ECDC7: Tcl_Finalize (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ECC59: Tcl_Exit (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51B5A9E: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ACDBD: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51EF4BD: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
==27948== 
==27948== 
==27948== Process terminating with default action of signal 11 (SIGSEGV)
==27948==  Access not within mapped region at address 0x10
==27948==    at 0x54A2124: pthread_mutex_lock (pthread_mutex_lock.c:50)
==27948==    by 0x5701F96: XrmDestroyDatabase (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x56E9C39: _XFreeDisplayStructure (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x56D702E: XCloseDisplay (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==27948==    by 0x4E9238D: ??? (in /usr/lib/libtk8.5.so.0)
==27948==    by 0x4E761AD: ??? (in /usr/lib/libtk8.5.so.0)
==27948==    by 0x51ECEDD: Tcl_FinalizeThread (in
/usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ECDC7: Tcl_Finalize (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ECC59: Tcl_Exit (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51B5A9E: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51ACDBD: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==    by 0x51EF4BD: ??? (in /usr/lib/libtcl8.5.so.0)
==27948==  If you believe this happened as a result of a stack
==27948==  overflow in your program's main thread (unlikely but
==27948==  possible), you can try to increase the size of the
==27948==  main thread stack using the --main-stacksize= flag.
==27948==  The main thread stack size used in this run was 8388608.
==27948== 
==27948== HEAP SUMMARY:
==27948==     in use at exit: 2,819,910 bytes in 2,158 blocks
==27948==   total heap usage: 14,790 allocs, 12,632 frees, 6,780,366
bytes allocated
==27948== 
==27948== LEAK SUMMARY:
==27948==    definitely lost: 0 bytes in 0 blocks
==27948==    indirectly lost: 0 bytes in 0 blocks
==27948==      possibly lost: 2,564,017 bytes in 147 blocks
==27948==    still reachable: 255,893 bytes in 2,011 blocks
==27948==         suppressed: 0 bytes in 0 blocks
==27948== Rerun with --leak-check=full to see details of leaked memory
==27948== 
==27948== For counts of detected and suppressed errors, rerun with: -v
==27948== Use --track-origins=yes to see where uninitialised values
come from
==27948== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 28 from
6)
Killed

I have traced what is going on this far....

The "package require Pltk" command calls the Pltk_Init
(bindings/tk/Pltk_Init.c) routine which defines the Tcl plframe
command using

Tcl_CreateCommand( interp, "plframe", (Tcl_CmdProc *) plFrameCmd,
   (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL );

where plFrameCmd is a C routine defined in bindings/tk/plframe.c.

So I suspect something in that C routine or the way that the above
Tcl_CreateCommand is called is the source of the segfault trouble
when the Tcl exit command is called.  But that is about the
limit of my knowledge so I hope you will be willing to look at
this further.

Meanwhile, because this segfault interferes with other tests, I have
temporarily dropped (revision 12707) the test_wish_standard_examples target 
from the
test_interactive target dependencies.  That still allows
running test_wish_standard_examples directly to aid in the investigation
of this segfault.

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
__________________________

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to