mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 05:31:44 +00:00
added a signal handler for FPE
This commit is contained in:
@@ -117,7 +117,7 @@ void carbon_master_cycle() {
|
||||
if (rlen < 1) goto clear;
|
||||
if (write(fd, ptr, rlen) <= 0) { uwsgi_error("write()"); goto clear;}
|
||||
|
||||
rlen = snprintf(ptr, 4096, "uwsgi.%s.%s.avg_rt %llu %llu\n", uwsgi.hostname, u_carbon.id, (unsigned long long ) total_avg_rt / avg_rt_workers, (unsigned long long ) uwsgi.current_time);
|
||||
rlen = snprintf(ptr, 4096, "uwsgi.%s.%s.avg_rt %llu %llu\n", uwsgi.hostname, u_carbon.id, (unsigned long long ) avg_rt_workers ? total_avg_rt / avg_rt_workers : 0, (unsigned long long ) uwsgi.current_time);
|
||||
if (rlen < 1) goto clear;
|
||||
if (write(fd, ptr, rlen) <= 0) { uwsgi_error("write()"); goto clear;}
|
||||
|
||||
|
||||
@@ -1105,6 +1105,19 @@ void uwsgi_segfault(int signum) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void uwsgi_fpe(int signum) {
|
||||
|
||||
uwsgi_log("!!! uWSGI process %d got Floating Point Exception !!!\n", (int) getpid());
|
||||
uwsgi_backtrace(uwsgi.backtrace_depth);
|
||||
|
||||
// restore default handler to generate core
|
||||
signal(signum, SIG_DFL);
|
||||
kill(getpid(), signum);
|
||||
|
||||
// never here...
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef UWSGI_AS_SHARED_LIBRARY
|
||||
int uwsgi_init(int argc, char *argv[], char *envp[]) {
|
||||
@@ -1142,6 +1155,7 @@ int main(int argc, char *argv[], char *envp[]) {
|
||||
//char *optname;
|
||||
|
||||
signal(SIGSEGV, uwsgi_segfault);
|
||||
signal(SIGFPE, uwsgi_fpe);
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
Reference in New Issue
Block a user