mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-03 23:48:22 +00:00
added --harakiri-verbose
This commit is contained in:
@@ -724,6 +724,40 @@ void master_loop(char **argv, char **environ) {
|
||||
/* TODO */
|
||||
/* then brutally kill the worker */
|
||||
uwsgi_log("*** HARAKIRI ON WORKER %d (pid: %d) ***\n", i, uwsgi.workers[i].pid);
|
||||
if (uwsgi.harakiri_verbose) {
|
||||
#ifdef __linux__
|
||||
int proc_file;
|
||||
char proc_buf[4096];
|
||||
char proc_name[64];
|
||||
ssize_t proc_len;
|
||||
|
||||
if (snprintf(proc_name, 64, "/proc/%d/syscall", uwsgi.workers[i].pid) > 0) {
|
||||
memset(proc_buf, 0, 4096);
|
||||
proc_file = open(proc_name, O_RDONLY);
|
||||
if (proc_file >= 0) {
|
||||
proc_len = read(proc_file, proc_buf, 4096);
|
||||
if (proc_len > 0) {
|
||||
uwsgi_log("HARAKIRI: -- syscall> %s", proc_buf);
|
||||
}
|
||||
close(proc_file);
|
||||
}
|
||||
}
|
||||
|
||||
if (snprintf(proc_name, 64, "/proc/%d/wchan", uwsgi.workers[i].pid) > 0) {
|
||||
memset(proc_buf, 0, 4096);
|
||||
|
||||
proc_file = open(proc_name, O_RDONLY);
|
||||
if (proc_file >= 0) {
|
||||
proc_len = read(proc_file, proc_buf, 4096);
|
||||
if (proc_len > 0) {
|
||||
uwsgi_log("HARAKIRI: -- wchan> %s\n", proc_buf);
|
||||
}
|
||||
close(proc_file);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
kill(uwsgi.workers[i].pid, SIGUSR2);
|
||||
// allow SIGUSR2 to be delivered
|
||||
sleep(1);
|
||||
|
||||
@@ -1615,11 +1615,12 @@ static PyTypeObject uwsgi_IterType = {
|
||||
PyObject *py_uwsgi_connect(PyObject * self, PyObject * args) {
|
||||
|
||||
char *socket_name = NULL;
|
||||
if (!PyArg_ParseTuple(args, "s:connect", &socket_name)) {
|
||||
int timeout = 0;
|
||||
if (!PyArg_ParseTuple(args, "s|i:connect", &socket_name, &timeout)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return PyInt_FromLong(uwsgi_connect(socket_name, 0, 0));
|
||||
return PyInt_FromLong(uwsgi_connect(socket_name, timeout, 0));
|
||||
}
|
||||
|
||||
PyObject *py_uwsgi_async_connect(PyObject * self, PyObject * args) {
|
||||
|
||||
@@ -40,6 +40,7 @@ static struct option long_base_options[] = {
|
||||
{"processes", required_argument, 0, 'p'},
|
||||
{"workers", required_argument, 0, 'p'},
|
||||
{"harakiri", required_argument, 0, 't'},
|
||||
{"harakiri-verbose", no_argument, &uwsgi.harakiri_verbose, 1},
|
||||
#ifdef UWSGI_XML
|
||||
{"xmlconfig", required_argument, 0, 'x'},
|
||||
#endif
|
||||
|
||||
@@ -100,6 +100,11 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <linux/limits.h>
|
||||
#include <sys/mount.h>
|
||||
#ifdef UWSGI_PTRACE
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/reg.h>
|
||||
#endif
|
||||
extern int pivot_root(const char * new_root, const char * put_old);
|
||||
#else
|
||||
#include <limits.h>
|
||||
@@ -809,6 +814,8 @@ struct uwsgi_server {
|
||||
|
||||
char *pidfile;
|
||||
|
||||
int harakiri_verbose;
|
||||
|
||||
int numproc;
|
||||
int async;
|
||||
int async_running;
|
||||
|
||||
Reference in New Issue
Block a user