Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.1preview1 #2

Closed
schmurfy opened this issue Nov 13, 2013 · 2 comments
Closed

2.1preview1 #2

schmurfy opened this issue Nov 13, 2013 · 2 comments

Comments

@schmurfy
Copy link

is the preview1 release supported or does it requires a more recent one ?

I just tried it but I get some "Symbol not found: _rb_profile_frames" errors :(

@tmm1
Copy link
Owner

tmm1 commented Nov 13, 2013

This function was recently added to trunk. You'll need to roll your own build.

@schmurfy
Copy link
Author

ok thanks.

XrXr added a commit to XrXr/stackprof that referenced this issue Dec 10, 2024
I got a SEGV core dump with the stack trace as follows:

    #0  __pthread_kill_implementation (no_tid=0, signo=14, threadid=0) at ./nptl/pthread_kill.c:50
    tmm1#1  __pthread_kill_internal (signo=14, threadid=0) at ./nptl/pthread_kill.c:78
    tmm1#2  __GI___pthread_kill (threadid=0, signo=14) at ./nptl/pthread_kill.c:89
    tmm1#3  <signal handler called> () at /lib/x86_64-linux-gnu/libc.so.6
    tmm1#4  stackprof_start (argc=<optimized out>, argv=<optimized out>, self=<optimized out>) at stackprof.c:228
    tmm1#5  vm_call_cfunc_with_frame_
    ...

Notice that `threadid=0` in the top frame -- the SEGV comes from inside
libc as it tries to dereference `threadid`.

The signal comes from stackprof's signal handler:

    if (pthread_self() != _stackprof.target_thread) {
        pthread_kill(_stackprof.target_thread, sig);
        return;
    }

During stackprof_start(), `_stackprof.target_thread` is 0.

You can recreate the stack trace in the crash with a program that does
`pthread_kill(0, SIGALRM)`:

    #include <signal.h>

    int
    main(void)
    {
       pthread_kill(0, SIGALRM);
    }

Only set `running` after target_thread is set to avoid this crash in
case the timer expires after `settimer()` but before setting
`target_thread`.

Also, since the ordering is important here, make `running`
`volatile sig_atomic_t` to prevent the compiler from doing unwanted
reordering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants