On Thu, Dec 19, 2013 at 06:26:48PM -0800, Alan Irwin wrote:
> On 2013-12-19 16:11-0800 Alan W. Irwin wrote:
> 
> > On 2013-12-19 22:50-0000 Andrew Ross wrote:
> >> Eventually I managed to get through almost all the tests though. The
> >> only issue I encountered was a segfault with the C++ qt_example for the
> >> nondyndriver case. Valgrind shows an invalid call to free / delete and
> >> a memory access violation. The shared case is fine with valgrind so I
> >> assume it is something about the static drivers.
> >
> >>
> >> For the fully static case I do not get a segfault, but valgrind shows a
> >> load or invalid reads in wx libraries ?!?
> >>
> >> Alan, do your tests reproduce this? I'll try a debug build to see if I
> >> can get to the bottom of it.
> >
> > qt_example has had a severe memory management issue in the recent past
> > (say over the last year or so)
> > which I worked around by not permitting qt_example to be built for the
> > static drivers case (e.g., for the PLplot-5.9.10 release).  But my
> > recent build-system changes for the Qt4-related parts of the PLplot
> > build solved that issue (as confirmed by valgrind) so I enabled
> > qt_example again for the static drivers case.
> >
> > But in light of your seeing more symptoms, I will check that again
> > with valgrind runs for my system version of Qt4 and also the epa_build
> > version of Qt4 and get back to you with those results. Please keep in
> > touch on what your further investigation finds as well. It's possible
> > the qt_example memory management trouble only occurs for certain
> > versions of Qt4.
> 
> Here is the build-tree result for the system version of Qt4 (i.e.,
> 
> -- Found Qt4: /usr/bin/qmake (found suitable version "4.8.2", minimum
> required is "4.8.2") 
> -- NP_QT_COMPILE_DEFINITIONS = QT_SVG_LIB;QT_GUI_LIB;QT_CORE_LIB
> -- QT_COMPILE_DEFINITIONS = -DQT_SVG_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB
> -- NP_QT_INCLUDE_DIRECTORIES = 
> /usr/include/qt4;/usr/include/qt4/QtSvg;/usr/include/qt4/QtGui;/usr/include/qt4/QtCore
> -- QT_INCLUDE_DIRECTORIES = -isystem /usr/include/qt4;-isystem 
> /usr/include/qt4/QtSvg;-isystem /usr/include/qt4/QtGui;-isystem 
> /usr/include/qt4/QtCore
> ) for the -DENABLE_DYNDRIVERS=OFF case and after
> running "make test_qt_example" to build all the dependencies of
> qt_example:
> 
> ==31199== Memcheck, a memory error detector
> ==31199== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
> ==31199== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
> ==31199== Command: examples/c++/qt_example
> ==31199== 
> ==31199== 
> ==31199== HEAP SUMMARY:
> ==31199==     in use at exit: 275,941 bytes in 2,457 blocks
> ==31199==   total heap usage: 44,202 allocs, 41,745 frees, 15,616,431 bytes 
> allocated
> ==31199== 
> ==31199== LEAK SUMMARY:
> ==31199==    definitely lost: 3,888 bytes in 37 blocks
> ==31199==    indirectly lost: 11,082 bytes in 223 blocks
> ==31199==      possibly lost: 2,448 bytes in 7 blocks
> ==31199==    still reachable: 258,523 bytes in 2,190 blocks
> ==31199==         suppressed: 0 bytes in 0 blocks
> ==31199== Rerun with --leak-check=full to see details of leaked memory
> ==31199== 
> ==31199== For counts of detected and suppressed errors, rerun with: -v
> ==31199== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 8)
> 
> Here is the equivalent -DENABLE_DYNDRIVERS=OFF build-tree results for the 
> epa_build version of Qt4 (which I
> obtained by running "make build_qt4_lite" under epa_build
> and simply changing the PATH prior to my ordinary PLplot build
> so that qmake version was found (which sucks in the rest of that
> version of Qt4).
> 
> -- Found Qt4: /home/wine/newstart/build_script/install-linux/bin/qmake (found 
> suitable version "4.8.5", minimum required is "4.8.2") 
> -- NP_QT_COMPILE_DEFINITIONS = QT_SVG_LIB;QT_GUI_LIB;QT_CORE_LIB
> -- QT_COMPILE_DEFINITIONS = -DQT_SVG_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB
> -- NP_QT_INCLUDE_DIRECTORIES = 
> /home/wine/newstart/build_script/install-linux/include;/home/wine/newstart/build_script/install-linux/include/QtSvg;/home/wine/newstart/build_script/install-linux/include/QtGui;/home/wine/newstart/build_script/install-linux/include/QtCore
> -- QT_INCLUDE_DIRECTORIES = -isystem 
> /home/wine/newstart/build_script/install-linux/include;-isystem 
> /home/wine/newstart/build_script/install-linux/include/QtSvg;-isystem 
> /home/wine/newstart/build_script/install-linux/include/QtGui;-isystem 
> /home/wine/newstart/build_script/install-linux/include/QtCore
> 
> ==5108== Memcheck, a memory error detector
> ==5108== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
> ==5108== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
> info
> ==5108== Command: examples/c++/qt_example
> ==5108== 
> ==5108== 
> ==5108== HEAP SUMMARY:
> ==5108==     in use at exit: 244,694 bytes in 2,230 blocks
> ==5108==   total heap usage: 42,734 allocs, 40,504 frees, 15,350,113
> bytes allocated
> ==5108== 
> ==5108== LEAK SUMMARY:
> ==5108==    definitely lost: 1,000 bytes in 23 blocks
> ==5108==    indirectly lost: 5,518 bytes in 65 blocks
> ==5108==      possibly lost: 2,448 bytes in 7 blocks
> ==5108==    still reachable: 235,728 bytes in 2,135 blocks
> ==5108==         suppressed: 0 bytes in 0 blocks
> ==5108== Rerun with --leak-check=full to see details of leaked memory
> ==5108== 
> ==5108== For counts of detected and suppressed errors, rerun with: -v
> ==5108== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
> 
> These valgrind results and the ones above show memory management is
> fine (except for some leak issues) for both these cases on my platform
> so I do not confirm the bad valgrind results for the
> -DENABLE_DYNDRIVERS=OFF qt_example case you observe on your platform.
> 
> To investigate further whether it is the Qt4 version accessible on
> your platform that is the cause of the qt_example memory management
> issue on your platform, I suggest you might want to try the
> build_qt4_lite target of epa_build yourself to see if you can match my
> good results for that case.  (That "lite" Qt4 build only takes ~15
> minutes on my computer and satisfies all of the ordinary PLplot build
> needs according to my tests.)

Hi Alan,

Using the epa qt_lite approach as you suggest I still see the problem.
Output of cmake is identical to you:

-- Found Qt4: /home/andrew/software/build_script/install-linux/bin/qmake (found 
suitable version "4.8.5", minimum required is "4.8.2") 
-- NP_QT_COMPILE_DEFINITIONS = QT_SVG_LIB;QT_GUI_LIB;QT_CORE_LIB
-- QT_COMPILE_DEFINITIONS = -DQT_SVG_LIB;-DQT_GUI_LIB;-DQT_CORE_LIB
-- NP_QT_INCLUDE_DIRECTORIES = 
/home/andrew/software/build_script/install-linux/include;/home/andrew/software/build_script/install-linux/include/QtSvg;/home/andrew/software/build_script/install-linux/include/QtGui;/home/andrew/software/build_script/install-linux/include/QtCore
-- QT_INCLUDE_DIRECTORIES = -isystem 
/home/andrew/software/build_script/install-linux/include;-isystem 
/home/andrew/software/build_script/install-linux/include/QtSvg;-isystem 
/home/andrew/software/build_script/install-linux/include/QtGui;-isystem 
/home/andrew/software/build_script/install-linux/include/QtCore
-- pc_qt_COMPILE_FLAGS = 
-I/home/andrew/software/build_script/install-linux/include 
-I/home/andrew/software/build_script/install-linux/include/QtSvg 
-I/home/andrew/software/build_script/install-linux/include/QtGui 
-I/home/andrew/software/build_script/install-linux/include/QtCore

 ==18128== Memcheck, a memory error detector
==18128== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==18128== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==18128== Command: ./qt_example
==18128== 
==18128== Invalid free() / delete / delete[] / realloc()
==18128==    at 0x4C2BADC: operator delete(void*) (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18128==    by 0x6DD0479: __cxa_finalize (cxa_finalize.c:55)
==18128==    by 0x62CFD12: ??? (in 
/home/andrew/software/plplot/build_nondyn2/src/libplplotd.so.12.0.0)
==18128==    by 0x400FF26: _dl_fini (dl-fini.c:253)
==18128==    by 0x6DD0070: __run_exit_handlers (exit.c:77)
==18128==    by 0x6DD00F4: exit (exit.c:99)
==18128==    by 0x6DB5DEB: (below main) (libc-start.c:294)
==18128==  Address 0xafb44b0 is 0 bytes inside a block of size 40 free'd
==18128==    at 0x4C2BADC: operator delete(void*) (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18128==    by 0x6DD0479: __cxa_finalize (cxa_finalize.c:55)
==18128==    by 0x60A8F52: ??? (in 
/home/andrew/software/plplot/build_nondyn2/bindings/qt_gui/libplplotqtd.so.1.0.0)
==18128==    by 0x400FF26: _dl_fini (dl-fini.c:253)
==18128==    by 0x6DD0070: __run_exit_handlers (exit.c:77)
==18128==    by 0x6DD00F4: exit (exit.c:99)
==18128==    by 0x6DB5DEB: (below main) (libc-start.c:294)
==18128== 
==18128== Invalid read of size 1
==18128==    at 0x5CCF71D: QObject::~QObject() (in 
/home/andrew/software/build_script/install-linux/lib/libQtCore.so.4.8.5)
==18128==    by 0x60AE780: MasterHandler::~MasterHandler() (qt.h:96)
==18128==    by 0x6DD0479: __cxa_finalize (cxa_finalize.c:55)
==18128==    by 0x62CFD12: ??? (in 
/home/andrew/software/plplot/build_nondyn2/src/libplplotd.so.12.0.0)
==18128==    by 0x400FF26: _dl_fini (dl-fini.c:253)
==18128==    by 0x6DD0070: __run_exit_handlers (exit.c:77)
==18128==    by 0x6DD00F4: exit (exit.c:99)
==18128==    by 0x6DB5DEB: (below main) (libc-start.c:294)
==18128==  Address 0x20 is not stack'd, malloc'd or (recently) free'd
==18128== 
==18128== 
==18128== Process terminating with default action of signal 11 (SIGSEGV)
==18128==  Access not within mapped region at address 0x20
==18128==    at 0x5CCF71D: QObject::~QObject() (in 
/home/andrew/software/build_script/install-linux/lib/libQtCore.so.4.8.5)
==18128==    by 0x60AE780: MasterHandler::~MasterHandler() (qt.h:96)
==18128==    by 0x6DD0479: __cxa_finalize (cxa_finalize.c:55)
==18128==    by 0x62CFD12: ??? (in 
/home/andrew/software/plplot/build_nondyn2/src/libplplotd.so.12.0.0)
==18128==    by 0x400FF26: _dl_fini (dl-fini.c:253)
==18128==    by 0x6DD0070: __run_exit_handlers (exit.c:77)
==18128==    by 0x6DD00F4: exit (exit.c:99)
==18128==    by 0x6DB5DEB: (below main) (libc-start.c:294)
==18128==  If you believe this happened as a result of a stack
==18128==  overflow in your program's main thread (unlikely but
==18128==  possible), you can try to increase the size of the
==18128==  main thread stack using the --main-stacksize= flag.
==18128==  The main thread stack size used in this run was 8388608.
==18128== 
==18128== HEAP SUMMARY:
==18128==     in use at exit: 329,908 bytes in 4,265 blocks
==18128==   total heap usage: 45,923 allocs, 41,659 frees, 7,854,870 bytes 
allocated
==18128== 
==18128== LEAK SUMMARY:
==18128==    definitely lost: 7,704 bytes in 35 blocks
==18128==    indirectly lost: 4,592 bytes in 160 blocks
==18128==      possibly lost: 4,676 bytes in 83 blocks
==18128==    still reachable: 312,936 bytes in 3,987 blocks
==18128==         suppressed: 0 bytes in 0 blocks
==18128== Rerun with --leak-check=full to see details of leaked memory
==18128== 
==18128== For counts of detected and suppressed errors, rerun with: -v
==18128== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 2 from 2)
Segmentation fault (core dumped)

As you can see, even compiling with debug flags (-g) the output is not 
particularly enlightening. Looks like it is not the Qt version per se 
that is the problem. Perhaps g++ version? Anyway, I'm still not sure 
how to take this further. Since it is not reproducible by you and most
Linux users with use dynamically loaded drivers I don't think this is
release critical, but I would like to understand it.

Andrew

------------------------------------------------------------------------------
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
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to