-
Notifications
You must be signed in to change notification settings - Fork 479
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
support trigger action on signal #340
Comments
Hi @namhyung , I tried it but seemed not work. The process terminated after sending USR2 signal.
|
@atwufei thanks for testing! Could you please confirm that it's because of |
I swapped the signals, it terminated as long as I sent SIGUSR2, SIGUSR1 had no problem. I also change SIGUSR2 to other signals such as SIGXCPU, SIGPROF, they behaved the same as SIGUSR2. |
There's a possibility that mysqld has its own handlers for those signals and it overwrites handlers in uftrace. What about real-time signals like |
That's possible. I tried this but uftrace didn't get any data:
|
The
|
kill -SIGRTMIN+1 (35 actually), then mysqld terminated. I need to figure out how mysqld handles signals first. |
Pushed rebased version to review/signal-trigger-v2 |
Pushed to review/signal-trigger-v3. Changelog:
Example:
|
Thanks for doing this work, but it seems that the signal is not properly catched by uftrace. I've made an example that keeps running GC operations and runs it on
But after running this, when it gets
|
One more request is that it'd be better to make it possible to use signal number as well. I would like to use the following method.
It took me some time to write the long signal name to send signal to it, so would like to simply send the number. It'd be much easier to use the same number for both
|
Could you please verify if the node installed new signal handlers? You can set filters on the signal functions. |
I did it on my machine and found
|
Thanks for finding it out. But I was trying to use |
Thanks for the work. I have some requests to print the below info.
I think it'd be better to keep caller path even when tracing is disabled. This info can be useful when tracing is on in the middle of call stack. I think it'd be really nice to be similar to Lastly, would it be possible to provide a simpler way for the current method?
|
I guess it's working with SIGRTMIN/MAX now, right? Regarding the print, I'm ok with showing pid at the beginning as it's printed before child is running. But not sure about signal receive since it could mess up the output from child. Maybe we could use And keeping caller looks a good idea - I'll think about how to do it. Lastly, maybe we could remove 'SIG' prefix.. how about this?
|
Yes, it's working fine with
Good.
You're right. I'm fine with printing it using
Thanks!
I'm fine with it, but I'd be good to accept a multiple way using |
Pushed review/signal-trigger-v4 Changelog:
Note:
|
Thanks for the work! I found that it works fine with the below test:
But I'm not sure if the below usage is wrong. It shows that parsing signal is failed.
And it may not be directly related to this work but I'm just wondering if the name of |
Oh, I forgot to handle numbers for real-time signals, will fix. Also I agree the name is confusing. What about |
Hmm.. |
It mostly works fine but somestimes get segfault, but I don't know how to reproduce it.
|
This may be a weird usage but would it be possible to send signal directly to
|
A signal from a controlling terminal will be sent to each process in the foreground process group. The uftrace and target process is in a same process group by default so they will receive the signal separately. If we'd create a new process group, uftrace cannot receive the signal anymore since it'd be in the background. |
Pushed review/signal-trigger-v5 Changelog:
|
Thanks for the update. I will test it again when I have time on it. |
Pushed review/signal-trigger-v6 Changelog:
|
It seems to be working fine so far, but cannot guarantee the safety yet. I will tell you if I find some problems. Thanks! |
Note that this version survived from a stress test overnight. |
Very cool! Did you repeat |
No, they don't affect runtime behavior except for saving data. I just tested the |
I see. Thanks! |
Hmm.. I found a segfault, will take a look. |
Pushed review/signal-trigger-v7 Changelog:
|
Pushed review/signal-trigger-v8 Changelog:
|
I tested it for I have another request. It'd be really great to have a way to insert external note inside the trace record using signal. It could be the same way as #615. |
It can be shown as follows:
|
If possible, it's also needed to have a way to find unused signal from the target binary because the target program can override the signal. |
That could be done in the sender side as well - i.e. send signal + get current time ( Of course it'd be way more convenient having it in uftrace. Probably I'll add it as a trigger but I'm afraid that it needs some work (getting mtd + current time at least) in the signal handler which can affect the target process - it might crash or deadlock in the worst case. |
Okay. It's additional feature, so we can leave it as one of future work items. Thanks. |
Sometimes it needs to trace a long-running process or daemon and it might be hard to setup a trigger on a specific function. Add a signal trigger to control tracing behavior with signaling. Currently
trace-on
,trace-off
andfinish
actions are supported only.The code is available at review/signal-trigger-v1.
Example:
The text was updated successfully, but these errors were encountered: