Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Creating alarms for segfaults #145

Closed
prymitive opened this Issue · 14 comments

2 participants

@prymitive
Collaborator

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 have segfault-alarm = alarm_handler that would fire when any worker segfaults and pass whole backtrace to the alarm handler?

@unbit
Owner

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

@prymitive
Collaborator
@unbit
Owner

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.

@prymitive
Collaborator

No and I won't have time for it this week, go ahead with those changes.

@prymitive
Collaborator

Are those API changes done? I don't see any.

@unbit
Owner

still not. Need to fix 3 areas in 1.9 before (ruby fibers, fastcgi and mongrel2 support). Hope to work on that tomorrow

@prymitive
Collaborator

Ok, no rush, just let me know

@unbit
Owner

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...

@prymitive
Collaborator

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 ;)

@prymitive
Collaborator

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

@prymitive
Collaborator

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

@prymitive
Collaborator

Any chance we could finish this one before 1.9?

@unbit
Owner

yes for sure, i need to make a couple of corner-case-fixes and should be complete

@prymitive
Collaborator

It would be real handy if we could push this forward in not so distant future.

@unbit unbit closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.