From ef36ac0d1b72ab2c07ed6e0a3116b7265c3c0164 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 27 Feb 2017 22:37:00 -0800 Subject: xlator: do not call dlclose() when debugging Valgrind can not show the symbols if a .so after calling dlclose(). The unhelpful ??? in the output gets resolved properly with this change: ==25170== 344 bytes in 1 blocks are definitely lost in loss record 233 of 324 ==25170== at 0x4C29975: calloc (vg_replace_malloc.c:711) ==25170== by 0x52C7C0B: __gf_calloc (mem-pool.c:117) ==25170== by 0x12B0638A: ??? ==25170== by 0x528FCE6: __xlator_init (xlator.c:472) ==25170== by 0x528FE16: xlator_init (xlator.c:498) ==25170== by 0x52DA8D6: glusterfs_graph_init (graph.c:321) ==25170== by 0x52DB587: glusterfs_graph_activate (graph.c:695) ==25170== by 0x5046407: glfs_process_volfp (glfs-mgmt.c:79) ==25170== by 0x5043B9E: glfs_volumes_init (glfs.c:281) ==25170== by 0x5044FEC: glfs_init_common (glfs.c:986) ==25170== by 0x50451A7: glfs_init@@GFAPI_3.4.0 (glfs.c:1031) By not calling dlclose(), the dynamically loaded .so is still available upon program exit, and Valgrind is able to resolve the symbols. This will add an additional leak, so dlclose() is called for normal builds, but skipped when configuring with "./configure --enable-valgrind" or passing the "run-with-valgrind" xlator option. URL: http://valgrind.org/docs/manual/faq.html#faq.unhelpful Change-Id: I2044e21b1b8fcce32ad1a817fdd795218f967731 BUG: 1425623 Signed-off-by: Niels de Vos Reviewed-on: https://review.gluster.org/16809 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Samikshan Bairagya Reviewed-by: Kaleb KEITHLEY --- glusterfs.spec.in | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'glusterfs.spec.in') diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 6225d12e631..7a50a8e5ec5 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -13,6 +13,10 @@ # rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --with debug %{?_with_debug:%global _with_debug --enable-debug} +# if you wish to compile an rpm to run all processes under valgrind... +# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --with valgrind +%{?_with_valgrind:%global _with_valgrind --enable-valgrind} + # if you wish to compile an rpm with cmocka unit testing... # rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --with cmocka %{?_with_cmocka:%global _with_cmocka --enable-cmocka} @@ -550,6 +554,9 @@ Obsoletes: %{name}-geo-replication = %{version}-%{release} Requires: python-argparse %endif Requires: pyxattr +%if (0%{?_with_valgrind:1}) +Requires: valgrind +%endif %description server GlusterFS is a distributed file-system capable of scaling to several @@ -618,6 +625,7 @@ export CFLAGS %configure \ %{?_with_cmocka} \ %{?_with_debug} \ + %{?_with_valgrind} \ %{?_with_tmpfilesdir} \ %{?_without_bd} \ %{?_without_epoll} \ -- cgit