This sounds like your typical problem with code which is not thread
safe, or where you have import order dependencies in code and things
will only work properly if URLs requested in certain order. Once the
critical URL has been hit and the modules finally imported properly,
then all works fine.

You could always use a WSGI middleware wrapper to log the order in
which URL requests come and the responses for the initial life of the
process. Then replicate in a test environment any order captured.

Another possibility is if you rely on caching systems being loaded,
but that only occurs on initial request and concurrent requests are
wrongly thinking cache is loaded when only process of loading it has
started. Those concurrent requests can fail. This can be due to
caching system not being thread safe in access or update.

Graham

On 6 November 2012 17:06, mtk <[email protected]> wrote:
> Hi everyone,
>
> We've been trying to debug a strange problem in our mod_wsgi/apache
> configuration.  We have a mostly working configuration that serves thousands
> of successful requests per day, but a few requests will incorrectly return a
> 404 (same request will work again immediately after).  We noticed that when
> we restart our webservers, we also get a bunch of 404s for the first
> requests which we always handled by quickly refreshing the page until they
> stopped.  We've configured our daemon processes to restart after several
> thousand requests, so it seems like the random 404 are caused by a daemon
> process just starting (looking through apache logs, the access log reports a
> 404 and there's output in the error log indicating our app modules have been
> loaded again at the same time, but nothing else).  Our wsgi application is a
> bit slow to load (on the order of couple hundred miliseconds, and maybe 1 or
> 2 seconds if there's a lot of load), so maybe there is some kind of timeout
> the apache processes have waiting for results from a daemon?
>
> Really appreciate any ideas or suggestions on how to debug.
>
> Here's relevant version and config info:
> Apache/2.2.22
> Python/2.7.3
> mod_wsgi/3.3
> werkzeug/flask .8
>
>
> apache2.conf:
> LoadModule wsgi_module modules/mod_wsgi.so
> ...
> WSGIRestrictEmbedded On
> WSGISocketPrefix /var/run/wsgi
> WSGIPythonHome /python/home/directory
> ...
> <VirtualHost *:80>
> ...
> WSGIDaemonProcess group_name processes=10 threads=15 display-name=worker
> maximum-requests=10000
> WSGIProcessGroup group_name
> WSGIScriptAlias / /path_to_wsgi
> WSGIApplicationGroup %{GLOBAL}
> ...
> </VirtualHost>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/qINw6J75kHAJ.
> 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.

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