elehcim / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

CPU profiler segfault #662

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. built libunwind-0.99-beta as a static library and put it in a user-defined 
folder (not /usr/local)

2. also build gperftools-2.3 as a static library and put it in a user-defined 
folder

3. used the -ltcmalloc_and_profiler flag to put it in the project

4. Everthing compiles fine

5. called ProfilerStart() -> ProfilerFlush() -> ProfilerStop()

6. 90% of the time, it will segfault. 10% of the time, it will complete the 
program

What is the expected output? What do you see instead?
#0  0x00000000004691a3 in access_mem ()
#1  0x0000000000469d3d in dwarf_get ()
#2  0x000000000046ba6d in apply_reg_state ()
#3  0x000000000046bee3 in _ULx86_64_dwarf_find_save_locs ()
#4  0x0000000000468d95 in _ULx86_64_dwarf_step ()
#5  0x0000000000468914 in _ULx86_64_step ()
#6  0x0000000000458279 in GetStackTraceWithContext_libunwind (
    result=<optimized out>, max_depth=63, skip_count=<optimized out>, 
    ucp=<optimized out>) at src/stacktrace_libunwind-inl.h:136
#7  0x0000000000458c0e in GetStackTraceWithContext (
    result=result@entry=0x7fffffffcf38, max_depth=max_depth@entry=63, 
    skip_count=skip_count@entry=2, uc=<optimized out>) at src/stacktrace.cc:240
#8  0x000000000044cfc4 in CpuProfiler::prof_handler (
    signal_ucontext=<optimized out>, 
    cpu_profiler=0x6a6ec0 <CpuProfiler::instance_>, sig=<optimized out>)
    at src/profiler.cc:358
#9  0x000000000044db13 in ProfileHandler::SignalHandler (sig=27, 
    sinfo=0x7fffffffd2f0, ucontext=0x7fffffffd1c0)
    at src/profile-handler.cc:631
#10 <signal handler called>

What version of the product are you using? On what operating system?

I'm using 2.3, ubuntu LTS 12.04

Please provide any additional information below.

It seems to be the same problem as this one?

https://code.google.com/p/gperftools/issues/detail?id=522

Original issue reported on code.google.com by Liu.Ru...@gmail.com on 17 Dec 2014 at 3:51

GoogleCodeExporter commented 9 years ago
Thanks for raising it. There is non-zero chance that libunwind is cause of 
crash here.

Please consider the following:

* try later versions of libunwind

* try various ./configure flags to libunwind. Specifically 
--enable-conservative-checks and --enable-debug-frame look like config flags 
that might affect this case

* report back your results please :)

Original comment by alkondratenko on 19 Dec 2014 at 4:10

GoogleCodeExporter commented 9 years ago
Upgraded to libunwind 1.0.1 and it works! Thanks!

Will follow the suggested boilerplate when writing code to be profiled.

Original comment by Liu.Ru...@gmail.com on 19 Dec 2014 at 6:43

GoogleCodeExporter commented 9 years ago
Closing then. Thanks.

Original comment by alkondratenko on 20 Dec 2014 at 3:40