mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-04 04:31:44 +00:00
if --harakiri and --py-tracebacker are both specified you will get a python traceback on harakiri
This commit is contained in:
@@ -1755,6 +1755,30 @@ int uwsgi_python_mule_msg(char *message, size_t len) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void uwsgi_python_harakiri(int wid) {
|
||||
|
||||
if (up.tracebacker) {
|
||||
|
||||
char buf[8192];
|
||||
char *address = uwsgi_concat2(up.tracebacker, uwsgi_num2str(wid));
|
||||
|
||||
int fd = uwsgi_connect(address, -1, 0);
|
||||
for (;;) {
|
||||
int ret = uwsgi_waitfd(fd, uwsgi.shared->options[UWSGI_OPTION_SOCKET_TIMEOUT]);
|
||||
if (ret <= 0) {
|
||||
break;
|
||||
}
|
||||
ssize_t len = read(fd, buf, 8192);
|
||||
if (len <= 0) {
|
||||
break;
|
||||
}
|
||||
uwsgi_log("%.*s", (int) len, buf);
|
||||
}
|
||||
|
||||
free(address);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifndef UWSGI_PYPY
|
||||
struct uwsgi_plugin python_plugin = {
|
||||
@@ -1789,6 +1813,8 @@ struct uwsgi_plugin pypy_plugin = {
|
||||
.resume = uwsgi_python_resume,
|
||||
#endif
|
||||
|
||||
.harakiri = uwsgi_python_harakiri,
|
||||
|
||||
.hijack_worker = uwsgi_python_hijack,
|
||||
.spooler_init = uwsgi_python_spooler_init,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user