Jamie Kirkpatrick
jkp at kirkconsulting.co.uk
Wed Mar 16 04:42:16 EST 2005
<snip> > Next thing to try would be to add logging inside the > get_interpreter() function. > Suggest logging the "name" input parameter supplied to the function, > but more > importantly log whether the "interpreters" global variable is > actually set when > the function is being called. Ie., > > if (!interpreters) { > ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, req, > "python_handler: interpreters dictionary not > initialised."); > return NULL; > } > > There is a return near the end of the function as well which doesn't > log anything > which you could add something for as well. > > if (!idata->obcallback) > { > #ifdef WITH_THREAD > PyEval_ReleaseThread(tstate); > #endif > PyThreadState_Delete(tstate); > ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, req, > "python_handler: no interpreter callback > found."); > > return NULL; > } Firstly, not that this code is slightly different to that which you posted -> if (!idata->obcallback) { idata->obcallback = make_obcallback(srv); if (!idata->obcallback) { #ifdef WITH_THREAD PyEval_ReleaseThread(tstate); #endif PyThreadState_Delete(tstate); return NULL; } } Anyway, I added the logging though I think you meant to tell me to use a different function (ap_log_error?) I used something along the lines of ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, srv, "Error message here."); Then I built things again installed and started with a start command. The log showed this on a call to test.py [Wed Mar 16 09:25:58 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:25:58 2005] [error] thegrove.homeip.net [Wed Mar 16 09:25:59 2005] [notice] mod_python: (Re)importing module 'test' [Wed Mar 16 09:25:59 2005] [error] start import [Wed Mar 16 09:25:59 2005] [error] end import [Wed Mar 16 09:25:59 2005][error] start handler [Wed Mar 16 09:25:59 2005] [error] end handler [Wed Mar 16 09:25:59 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:26:05 2005] [notice] child pid 24966 exit signal Bus error (10) That's interesting coz it seems that after the request has been fulfilled the function is getting called again. It takes a minute for the child PID to die (presumably coz it has not data to work with?). Also, just to note that a start now seems to be invoking multiple instances of httpd 25282 ?? Ss 0:00.80 /opt/local/apache2/bin/httpd -k start 25283 ?? S 0:00.01 /opt/local/apache2/bin/httpd -k start 25284 ?? S 0:00.01 /opt/local/apache2/bin/httpd -k start 25285 ?? S 0:00.01 /opt/local/apache2/bin/httpd -k start 25286 ?? S 0:00.00 /opt/local/apache2/bin/httpd -k start 25287 ?? S 0:00.01 /opt/local/apache2/bin/httpd -k start Next after a restart: just after restarting, before calling anything I check the logs - [Wed Mar 16 09:33:26 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:33:26 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:33:26 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:33:26 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:33:26 2005] [error] interpreter name that was passed is: A minute or so later I check back and i see [Wed Mar 16 09:33:32 2005] [warn] child process 25283 still did not exit, sending a SIGTERM [Wed Mar 16 09:33:32 2005] [warn] child process 25284 still did not exit, sending a SIGTERM [Wed Mar 16 09:33:32 2005] [warn] child process 25285 still did not exit, sending a SIGTERM [Wed Mar 16 09:33:32 2005] [warn] child process 25286 still did not exit, sending a SIGTERM [Wed Mar 16 09:33:32 2005] [warn] child process 25287 still did not exit, sending a SIGTERM So for some reason it is spawing lots of children and then killing them off one by one after the restart. Seems odd to me that it is calling the get_interpreter() function here on a restart ( I would have imagined that would only happen when you call a script), anyway...the bit that we were after - the logs relating to trying to pull the page up after the restart: (I did it two times, so you can see how the same sequence repeats each time) [Wed Mar 16 09:34:43 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:34:43 2005] [error] thegrove.homeip.net [Wed Mar 16 09:34:43 2005] [error] python_handler: interpreters dictionary not initialised. [Wed Mar 16 09:35:10 2005] [error] interpreter name that was passed is: [Wed Mar 16 09:35:10 2005] [error] thegrove.homeip.net [Wed Mar 16 09:35:10 2005] [error] python_handler: interpreters dictionary not initialised. So a name is passed in, but it seems that global variable is not getting set :/ Right - i'll wait for you to get back to me now. I appoligise for not being able to take more initiative but I just havent got the time to lerarn the Apache API and to read all the code. I would actually be interested in some of this at a later point though since I am keen to port an authentication module to apache2. Look forward to hearing back from you. Jamie
|