On Feb 16, 1:43 am, Graham Dumpleton <[email protected]>
wrote:
> 2009/2/16 gert <[email protected]>:
>
>
>
> >> > My site spams allot of small ajax request :-)
>
> >> >> BTW, do you create any background threads from your application?
>
> >> > nope but i have this allot
>
> >> > [Mon Feb 16 00:24:20 2009] [info] mod_wsgi (pid=17142): Cleanup
> >> > interpreter ''.
> >> > [Mon Feb 16 00:24:20 2009] [info] mod_wsgi (pid=17142): Terminating
> >> > Python.
> >> > [Mon Feb 16 00:24:20 2009] [info] mod_wsgi (pid=17142): Python has
> >> > shutdown.
> >> > [Mon Feb 16 00:24:21 2009] [info] mod_wsgi (pid=17143): Cleanup
> >> > interpreter ''.
> >> > [Mon Feb 16 00:24:21 2009] [info] mod_wsgi (pid=17143): Terminating
> >> > Python.
> >> > [Mon Feb 16 00:24:21 2009] [info] mod_wsgi (pid=17143): Python has
> >> > shutdown.
>
> >> > so i am pretty sure when i edit a wsgi file while apache is doing the
> >> > above i will have a segfault
>
> >> Editing the WSGI file while this happening would have no affect, as
> >> once child server process starts to shutdown it isn't handing
> >> requests, so doesn't care if your file changes.
>
> >> Now, if you are seeing lots of these messages then you are possibly a
> >> classic example of those people who I am having a bit of a winge about
> >> in blog post I am writing at the moment. That is, using embedded mode,
> >> especially with prefork, but not bothering to adjust the MPM settings
> >> to something more appropriate for Python web applications.
>
> >> Are you still using prefork MPM? What are the MPM settings you are
> >> using? The defaults for prefork are:
>
> >> # prefork MPM
> >> # StartServers: number of server processes to start
> >> # MinSpareServers: minimum number of server processes which are kept spare
> >> # MaxSpareServers: maximum number of server processes which are kept spare
> >> # MaxClients: maximum number of server processes allowed to start
> >> # MaxRequestsPerChild: maximum number of requests a server process serves
> >> <IfModule mpm_prefork_module>
> >>     StartServers          5
> >>     MinSpareServers       5
> >>     MaxSpareServers      10
> >>     MaxClients          150
> >>     MaxRequestsPerChild   0
> >> </IfModule>
>
> >> What do you have? Or as usual have you completely butchered your
> >> Apache configuration file so it more or less has nothing in it,
> >> including no settings for those values?
>
> > 1) prefork,
> > 2) its called professional vacuuming your config files :-)
>
> > Now i don't argue about performance here, it should not do the
> > segfault thing whatever the child stuff should be. Actually you should
> > be giving me the worst settings ever so i can reproduce it quicker :P
>
> Looks like you are already using the worst settings possible.
>
> Since you didn't supply them, does that mean you aren't setting any of
> them at all, and thus Apache is using its defaults?

Yep,

>
>
> >> Back to the crash. I recently added the additional message:
>
> >>   [Mon Feb 16 00:24:21 2009] [info] mod_wsgi (pid=17143): Python has 
> >> shutdown.
>
> >> Are you seeing this ever time for corresponding message above it of:
>
> >>   [Mon Feb 16 00:24:21 2009] [info] mod_wsgi (pid=17143): Terminating 
> >> Python.
>
> >> If you aren't and you see the segmentation fault in some or all cases,
> >> then the crash is occuring when calling Py_Finalize() on Python
> >> interpreter.
>
> >> I also recently changed how thread state is acquired for calling
> >> Py_Finalize(). It used to create a new thread state just for that
> >> operation, but now it uses simplified GIL state API as it by rights
> >> should do. Before we look though at reverting that bit of code, answer
> >> the above questions about your configuration and the log messages.
>
> >  Python has shutdown never occurs after the segfault
>
> > If it crashed the sequence is always
> > : Destroy
> > : Cleanup
> > : Terminating Python.
> > : Segmentation fault (11)
>
> Replace your wsgi_python_term() function in mod_wsgi.c with older version:
>
> static apr_status_t wsgi_python_term()
> {
>     PyInterpreterState *interp = NULL;
>     PyThreadState *tstate = NULL;
>
>     ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), wsgi_server,
>                  "mod_wsgi (pid=%d): Terminating Python.", getpid());
>
>     PyEval_AcquireLock();
>
>     interp = PyInterpreterState_Head();
>     while (interp->next)
>         interp = interp->next;
>
>     tstate = PyThreadState_New(interp);
>     PyThreadState_Swap(tstate);
>
>     Py_Finalize();
>
>     PyThreadState_Swap(NULL);
>
>     PyEval_ReleaseLock();
>
>     wsgi_python_initialized = 0;
>
>     ap_log_error(APLOG_MARK, WSGI_LOG_INFO(0), wsgi_server,
>                  "mod_wsgi (pid=%d): Python has shutdown.", getpid());
>
>     return APR_SUCCESS;
>
> }
>
> With that, do you still see crashes?

Need sleep first, or boss will not be happy again when i pick up the
phone snoring

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to