From dd1881576a6306e9f20270cbcd55a1f1337d2e27 Mon Sep 17 00:00:00 2001 From: Unbit Date: Sun, 10 Mar 2013 22:22:16 +0100 Subject: [PATCH] removed grunt support --- core/init.c | 2 +- core/utils.c | 2 +- core/uwsgi.c | 1 - plugins/python/uwsgi_pymodule.c | 58 --------------------------------- 4 files changed, 2 insertions(+), 61 deletions(-) diff --git a/core/init.c b/core/init.c index a709468b..972092aa 100644 --- a/core/init.c +++ b/core/init.c @@ -296,7 +296,7 @@ void uwsgi_commandline_config() { void uwsgi_setup_workers() { int i, j; // allocate shared memory for workers + master - uwsgi.workers = (struct uwsgi_worker *) uwsgi_calloc_shared(sizeof(struct uwsgi_worker) * (uwsgi.numproc + 1 + uwsgi.grunt)); + uwsgi.workers = (struct uwsgi_worker *) uwsgi_calloc_shared(sizeof(struct uwsgi_worker) * (uwsgi.numproc + 1)); for (i = 0; i <= uwsgi.numproc; i++) { // allocate memory for apps diff --git a/core/utils.c b/core/utils.c index f1263672..647eb7bf 100644 --- a/core/utils.c +++ b/core/utils.c @@ -659,7 +659,7 @@ void uwsgi_close_request(struct wsgi_request *wsgi_req) { } // defunct process reaper - if (uwsgi.shared->options[UWSGI_OPTION_REAPER] == 1 || uwsgi.grunt) { + if (uwsgi.shared->options[UWSGI_OPTION_REAPER] == 1) { while (waitpid(WAIT_ANY, &waitpid_status, WNOHANG) > 0); } diff --git a/core/uwsgi.c b/core/uwsgi.c index 3c71316b..5593919d 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -483,7 +483,6 @@ static struct uwsgi_option uwsgi_base_options[] = { {"die-on-idle", no_argument, 0, "shutdown uWSGI when idle", uwsgi_opt_true, &uwsgi.die_on_idle, 0}, {"mount", required_argument, 0, "load application under mountpoint", uwsgi_opt_add_string_list, &uwsgi.mounts, 0}, {"worker-mount", required_argument, 0, "load application under mountpoint in the specified worker or after workers spawn", uwsgi_opt_add_string_list, &uwsgi.mounts, 0}, - {"grunt", no_argument, 0, "enable grunt mode (in-request fork)", uwsgi_opt_true, &uwsgi.grunt, 0}, {"threads", required_argument, 0, "run each worker in prethreaded mode with the specified number of threads", uwsgi_opt_set_int, &uwsgi.threads, UWSGI_OPT_THREADS}, {"thread-stacksize", required_argument, 0, "set threads stacksize", uwsgi_opt_set_int, &uwsgi.threads_stacksize, UWSGI_OPT_THREADS}, diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 5f2a5879..7626c436 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -2331,63 +2331,6 @@ PyObject *py_uwsgi_parse_file(PyObject * self, PyObject * args) { } -PyObject *py_uwsgi_grunt(PyObject * self, PyObject * args) { - - pid_t grunt_pid; - struct wsgi_request *wsgi_req = py_current_wsgi_req(); - - if (uwsgi.grunt) { - uwsgi_log("spawning a grunt from worker %d (pid :%d)...\n", uwsgi.mywid, uwsgi.mypid); - } - else { - uwsgi_log("grunt support is disabled !!!\n"); - goto clear; - } - - // use a normal fork here - grunt_pid = fork(); - if (grunt_pid < 0) { - uwsgi_error("fork()"); - goto clear; - } - // now i am a grunt, avoid it making mess - else if (grunt_pid == 0) { - // it will no more accepts requests - uwsgi_close_all_sockets(); - // create a new session - setsid(); - // exit on SIGPIPE - signal(SIGPIPE, (void *) &end_me); - // here we create a new worker. Each grunt will race on this datas, so do not rely on them - uwsgi.mywid = uwsgi.numproc + 1; - uwsgi.mypid = getpid(); - memset(&uwsgi.workers[uwsgi.mywid], 0, sizeof(struct uwsgi_worker)); - // this is pratically useless... - uwsgi.workers[uwsgi.mywid].id = uwsgi.mywid; - // this field will be overwrite after each call - uwsgi.workers[uwsgi.mywid].pid = uwsgi.mypid; - - // reset the random seed - uwsgi_python_reset_random_seed(); - // TODO - // manage thread in grunt processes - Py_INCREF(Py_True); - return Py_True; - } - - // close connection on the original worker - if (PyTuple_Size(args) == 0) { - if (wsgi_req->socket) { - wsgi_req->socket->proto_close(wsgi_req); - } - wsgi_req->fd_closed = 1; - } - - clear: - Py_INCREF(Py_None); - return Py_None; -} - static PyMethodDef uwsgi_spooler_methods[] = { #ifdef PYTHREE {"send_to_spooler", (PyCFunction) py_uwsgi_send_spool, METH_VARARGS | METH_KEYWORDS, ""}, @@ -2434,7 +2377,6 @@ static PyMethodDef uwsgi_advanced_methods[] = { {"get_logvar", py_uwsgi_get_logvar, METH_VARARGS, ""}, {"alarm", py_uwsgi_alarm, METH_VARARGS, ""}, {"disconnect", py_uwsgi_disconnect, METH_VARARGS, ""}, - {"grunt", py_uwsgi_grunt, METH_VARARGS, ""}, {"lock", py_uwsgi_lock, METH_VARARGS, ""}, {"is_locked", py_uwsgi_is_locked, METH_VARARGS, ""}, {"unlock", py_uwsgi_unlock, METH_VARARGS, ""},