Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Every test segfaults with -fsanitize=thread #119

Open
NAThompson opened this issue Aug 9, 2019 · 3 comments
Open

Every test segfaults with -fsanitize=thread #119

NAThompson opened this issue Aug 9, 2019 · 3 comments

Comments

@NAThompson
Copy link
Contributor

Add the following lines to src/CMakeLists.txt:

if(CMAKE_BUILD_TYPE MATCHES "Debug")
  if(CMAKE_CXX_COMPILER_ID MATCHES "^(AppleClang|Clang|GNU)")
    set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O2 -Wfatal-errors -fsanitize=thread -fno-omit-frame-pointer")
  endif()
endif()

Build without CUDA support, and then run:

$ ctest
...
The following tests FAILED:
	  1 - blt_gtest_smoke (SEGFAULT)
	  2 - blt_mpi_smoke (Failed)
	  3 - t_vtkm_smoke (SEGFAULT)
	  4 - t_diy_smoke (Failed)
	  5 - t_vtk-h_smoke (SEGFAULT)
	  6 - t_vtk-h_dataset (SEGFAULT)
	  7 - t_vtk-h_clip (SEGFAULT)
	  8 - t_vtk-h_clip_field (SEGFAULT)
	  9 - t_vtk-h_device_control (SEGFAULT)
	 10 - t_vtk-h_empty_data (SEGFAULT)
	 11 - t_vtk-h_ghost_stripper (SEGFAULT)
	 12 - t_vtk-h_iso_volume (SEGFAULT)
	 13 - t_vtk-h_no_op (SEGFAULT)
	 14 - t_vtk-h_marching_cubes (SEGFAULT)
	 15 - t_vtk-h_lagrangian (SEGFAULT)
	 16 - t_vtk-h_log (SEGFAULT)
	 17 - t_vtk-h_threshold (SEGFAULT)
	 18 - t_vtk-h_mesh_renderer (SEGFAULT)
	 19 - t_vtk-h_multi_render (SEGFAULT)
	 20 - t_vtk-h_point_renderer (SEGFAULT)
	 21 - t_vtk-h_raytracer (SEGFAULT)
	 22 - t_vtk-h_render (SEGFAULT)
	 23 - t_vtk-h_slice (SEGFAULT)
	 24 - t_vtk-h_vector_magnitude (SEGFAULT)
	 25 - t_vtk-h_volume_renderer (SEGFAULT)
	 26 - t_vtk-h_smoke_par (Failed)
	 27 - t_vtk-h_dataset_par (Failed)
	 28 - t_vtk-h_no_op_par (Failed)
	 29 - t_vtk-h_histogram_par (Failed)
	 30 - t_vtk-h_marching_cubes_par (Failed)
	 31 - t_vtk-h_multi_render_par (Failed)
	 32 - t_vtk-h_particle_advection_par (Failed)
	 33 - t_vtk-h_raytracer_par (Failed)
	 34 - t_vtk-h_sampling_par (Failed)
	 35 - t_vtk-h_volume_renderer_par (Failed)
Errors while running CTest
@cyrush
Copy link
Member

cyrush commented Aug 9, 2019

Any hints on where it is segfaulting? (gdb on one of the tests)

blt_gtest_smoke is about as simple as it gets:
https://github.com/LLNL/blt/blob/develop/tests/smoke/blt_gtest_smoke.cpp

The fact that everything is failing seems to point a configuration or compiler issue.

What compilers are you using?

@NAThompson
Copy link
Contributor Author

 g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@NAThompson NAThompson changed the title Every test segfaults with -fsanitize=address Every test segfaults with -fsanitize=thread Aug 9, 2019
@NAThompson
Copy link
Contributor Author

NAThompson commented Aug 9, 2019

@cyrush : I think you might be right about config/compiler issue.

File format ok:

vtkh file t_vtk-h_clip
t_vtk-h_clip: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, BuildID[sha1]=b2f2de316d2615216b17c248c1e3a38f2a2ac3c2, with debug_info, not stripped

Linking OK:

 vtkh ldd t_vtk-h_clip
	linux-vdso.so.1 (0x00007fff3e6f9000)
	libtsan.so.0 => /usr/lib/x86_64-linux-gnu/libtsan.so.0 (0x00007f6333230000)
	libgtest_main.so => /home/4nt/build_vtk-h/lib/libgtest_main.so (0x00007f633302e000)
	libgtest.so => /home/4nt/build_vtk-h/lib/libgtest.so (0x00007f6332dda000)
	libvtkh_rendering.so => /home/4nt/build_vtk-h/lib/libvtkh_rendering.so (0x00007f633235b000)
	libvtkh_filters.so => /home/4nt/build_vtk-h/lib/libvtkh_filters.so (0x00007f63313c8000)
	libvtkh_core.so => /home/4nt/build_vtk-h/lib/libvtkh_core.so (0x00007f6330cab000)
	libvtkh_utils.so => /home/4nt/build_vtk-h/lib/libvtkh_utils.so (0x00007f63304d3000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f63300f3000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f632fd55000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f632fb3d000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f632f74c000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f632f548000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f632f340000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f632f121000)
	libvtkh_lodepng.so => /home/4nt/build_vtk-h/lib/libvtkh_lodepng.so (0x00007f632eeff000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f6334183000)
gdb ./t_vtk-h_clip
(gdb) run
Starting program: /home/4nt/build_vtk-h/tests/vtkh/t_vtk-h_clip 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff7152b07 in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#2  0x00007ffff712e0d6 in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#3  0x00007ffff712e2ea in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#4  0x00007ffff712e35e in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#5  0x00007ffff712ca7f in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#6  0x00007ffff712cc6b in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#7  0x00007ffff70e5537 in calloc () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#8  0x00007ffff33d27e5 in _dlerror_run (operate=operate@entry=0x7ffff33d20d0 <dlsym_doit>, args=args@entry=0x7fffffffdc80) at dlerror.c:140
#9  0x00007ffff33d2166 in __dlsym (handle=<optimized out>, name=0x7ffff7176271 "mmap") at dlsym.c:70
#10 0x00007ffff7160245 in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#11 0x00007ffff7110135 in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#12 0x00007ffff7134b38 in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#13 0x00007ffff70e3cc3 in ?? () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#14 0x00007ffff70e4fc6 in __interceptor___cxa_atexit () from /usr/lib/x86_64-linux-gnu/libtsan.so.0
#15 0x00007ffff401dcd6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#16 0x00007ffff7de5733 in call_init (env=0x7fffffffde88, argv=0x7fffffffde78, argc=1, l=<optimized out>) at dl-init.c:72
#17 _dl_init (main_map=0x7ffff7ffe170, argc=1, argv=0x7fffffffde78, env=0x7fffffffde88) at dl-init.c:119
#18 0x00007ffff7dd60ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#19 0x0000000000000001 in ?? ()
#20 0x00007fffffffe1ed in ?? ()
#21 0x0000000000000000 in ?? ()

I'm going to retry with clang to see if I can get anywhere as this stack trace isn't helpful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants