Closed prymitive closed 10 years ago
You can trigger alarms in your code with
void uwsgi_alarm_run(struct uwsgi_alarm_instance uai, char msg, size_t len);
to get a uwsgi_alarm_instance pointer you can use:
struct uwsgi_alarm_instance uwsgi_alarm_get_instance(char name);
where name is the name of the alarm instance
the log-alarm subsystem simply trigger that for every logline that matches. You can add more cases in which to put that
Thanks, I'll try to implement alarms for segfaults and harakiri in few days.
Have you already started that ? I would like to clean the api a bit for making the triggering of alarms from processes other than the master easier.
No and I won't have time for it this week, go ahead with those changes.
Are those API changes done? I don't see any.
still not. Need to fix 3 areas in 1.9 before (ruby fibers, fastcgi and mongrel2 support). Hope to work on that tomorrow
Ok, no rush, just let me know
Ok, the api function is ready:
uwsgi_alarm_trigger(char alarm_name, char message, size_t message_size);
you can call it in all of the processes (or from apps, using uwsgi.alarm(name, msg))
I do not know how you intend to map it to the SEGV handler, maybe you have to combine the whole backtrace output to a single memory buffer...
I do not know how you intend to map it to the SEGV handler, maybe you have to combine the whole backtrace output to a single memory buffer...
I have no idea either, but not knowing before and knowing it once You're done is part of the fun ;)
BTW it looks like I might have busy week so I don't know if I'll be able to look into it until next weekend
Please review this patch It will break on each request since it will divide by zero (for testing).
./uwsgi --http :8080 --wsgi-file tests/staticfile.py --alarm "mailme cmd:mail -s 'uWSGI alarm' -r 'uwsgi@localhost' me@domain.com" --segfault-alarm mailme
and then just curl localhost:8000
Any chance we could finish this one before 1.9?
yes for sure, i need to make a couple of corner-case-fixes and should be complete
It would be real handy if we could push this forward in not so distant future.
I wanted to use alarm subsystem to notify me in case of any segfault, but
log-alarm
handles only single line at a time. Could we also havesegfault-alarm = alarm_handler
that would fire when any worker segfaults and pass whole backtrace to the alarm handler?