On Feb 17, 12:36 am, gert <[email protected]> wrote:
> On Feb 17, 12:25 am, gert <[email protected]> wrote:
>
> > 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?
>
> > > >> 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;
>
> > > }
>
> > Victory :)
>
> > [Tue Feb 17 00:22:18 2009] [info] mod_wsgi (pid=7150): Destroy
> > interpreter '127.0.0.1|/appwsgi/www/invoice/invoice.wsgi'.
> > [Tue Feb 17 00:22:18 2009] [info] mod_wsgi (pid=7150): Cleanup
> > interpreter ''.
> > [Tue Feb 17 00:22:18 2009] [info] mod_wsgi (pid=7150): Terminating
> > Python.
> > [Tue Feb 17 00:22:19 2009] [notice] child pid 7150 exit signal
> > Segmentation fault (11)
>
> > Just don't ask to do it again :P
>
> [Tue Feb 17 00:17:12 2009] [info] mod_wsgi (pid=6830): Destroy
> interpreter '127.0.0.1|/appwsgi/www/invoice/invoice.wsgi'.
> [Tue Feb 17 00:17:12 2009] [info] mod_wsgi (pid=6830): Cleanup
> interpreter ''.
> [Tue Feb 17 00:17:12 2009] [info] mod_wsgi (pid=6830): Terminating
> Python.
> [Tue Feb 17 00:17:13 2009] [notice] child pid 6830 exit signal
> Segmentation fault (11)
>
> looking trough the log there was a other crash before

i think i found a pattern, first there need to go something wrong
before it crashes :)
after a 500 chances increase to get a segfault on clean up

[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171] mod_wsgi
(pid=8972): Exception occurred processing WSGI script '/usr/httpd/www/
appwsgi/www/invoice/invoice.wsgi'., referer:
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171] Traceback
(most recent call last):, referer: 
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/httpd/www/appwsgi/www/invoice/invoice.wsgi", line 8, in
application, referer: 
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     v =
loads(environ['wsgi.input'].read().decode('latin1')), referer:
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/python/lib/python3.0/json/__init__.py", line 307, in loads,
referer: http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     return
_default_decoder.decode(s), referer: 
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/python/lib/python3.0/json/decoder.py", line 323, in decode,
referer: http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     obj,
end = self.raw_decode(s, idx=_w(s, 0).end()), referer:
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/python/lib/python3.0/json/decoder.py", line 340, in raw_decode,
referer: http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     obj,
end = next(self._scanner.iterscan(s, **kw)), referer:
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/python/lib/python3.0/json/scanner.py", line 55, in iterscan,
referer: http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     rval,
next_pos = action(m, context), referer: 
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/python/lib/python3.0/json/decoder.py", line 187, in JSONObject,
referer: http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     value,
end = next(iterscan(s, idx=end, context=context)), referer:
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/python/lib/python3.0/json/scanner.py", line 55, in iterscan,
referer: http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     rval,
next_pos = action(m, context), referer: 
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]   File "/
usr/python/lib/python3.0/json/decoder.py", line 159, in JSONString,
referer: http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171]     return
scanstring(match.string, match.end(), encoding, strict), referer:
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:48 2009] [error] [client 80.201.199.171] ValueError:
Invalid control character at: line 3 column 9 (char 43), referer:
http://91.121.53.159/appwsgi/www/invoice/invoice.htm?1-admin
[Tue Feb 17 00:41:52 2009] [info] mod_wsgi (pid=7265): Destroy
interpreter '127.0.0.1|/appwsgi/www/invoice/invoice.wsgi'.
[Tue Feb 17 00:41:52 2009] [info] mod_wsgi (pid=7265): Cleanup
interpreter ''.
[Tue Feb 17 00:41:52 2009] [info] mod_wsgi (pid=7265): Terminating
Python.
[Tue Feb 17 00:41:53 2009] [notice] child pid 7265 exit signal
Segmentation fault (11)

--~--~---------~--~----~------------~-------~--~----~
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