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

Creating alarms for segfaults #145

Closed
prymitive opened this issue Feb 1, 2013 · 14 comments
Closed

Creating alarms for segfaults #145

prymitive opened this issue Feb 1, 2013 · 14 comments

Comments

@prymitive
Copy link
Contributor

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
Copy link
Owner

unbit commented Feb 3, 2013

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
Copy link
Contributor Author

Thanks, I'll try to implement alarms for segfaults and harakiri in few days.

@unbit
Copy link
Owner

unbit commented Feb 7, 2013

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
Copy link
Contributor Author

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

@prymitive
Copy link
Contributor Author

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

@unbit
Copy link
Owner

unbit commented Feb 14, 2013

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

@prymitive
Copy link
Contributor Author

Ok, no rush, just let me know

@unbit
Copy link
Owner

unbit commented Feb 15, 2013

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

Any chance we could finish this one before 1.9?

@unbit
Copy link
Owner

unbit commented Feb 27, 2013

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

@prymitive
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants