[modwsgi] Re: 404 on first requests for daemon process

2012-11-10 Thread Gnarlodious
I get the same thing happening. My webapp takes a while to initialize, but 
meanwhile all requests get the error. Upon uploading a new version I run a 
curl command to make it start up, which minimizes the chance a user will 
get the error. I also notice that browsers are modernizing to be more 
standards-compliant, so that cache handling and request timeout can make a 
diagnosis difficult. Using the curl command to request the first page has 
the benefit of being more patient than a browser,  and no cache means 
obsolete pages are not returned.

I can imagine in the future the mod_wsgi module will send a minimal http 
header to prevent the browser from showing an error or cached page during 
webapp startup.

-- Gnarlie

-- 
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/-/84adKgNJM6IJ.
To post to this group, send email to modwsgi@googlegroups.com.
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.



Re: [modwsgi] Re: 404 on first requests for daemon process

2012-11-10 Thread Joonas Lehtolahti
On Sat, 10 Nov 2012 16:45:33 +0200, Gnarlodious gnarlodi...@gmail.com  
wrote:


I get the same thing happening. My webapp takes a while to initialize,  
but
meanwhile all requests get the error. Upon uploading a new version I run  
a

curl command to make it start up, which minimizes the chance a user will
get the error. I also notice that browsers are modernizing to be more
standards-compliant, so that cache handling and request timeout can make  
a

diagnosis difficult. Using the curl command to request the first page has
the benefit of being more patient than a browser,  and no cache means
obsolete pages are not returned.

I can imagine in the future the mod_wsgi module will send a minimal http
header to prevent the browser from showing an error or cached page during
webapp startup.

-- Gnarlie


But if the error is 404, that comes from server side. No client generates  
fake 404 error to my knowledge, it is server response to say that the  
requested resource was not found. In this light mod_wsgi sending minimal  
http header at start won't do anything since the server *is* sending  
header and the browser is getting it. Only that the response is not what  
you would expect.


Graham (or others knowing the deep insides of mod_wsgi), is there any case  
where Apache would be sending 404 if mod_wsgi is stalling, or will it  
always wait for the response from WSGI application or timeout with some  
other error? I couldn't imagine Apache sending 404 randomly for a resource  
handled by specific handler without the handler itself returning 404.  
(could it be the webapp itself is sending 404?)


- Joonas

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



Re: [modwsgi] Re: 404 on first requests for daemon process

2012-11-10 Thread Graham Dumpleton
This sounds more like you are doing lazy initialisation of application
data/caches on the first request and they are not protected against
access from multiple threads properly. The first thread probably does
enough setup to make subsequent requests think that initialisation has
completed when it hasn't, so when they hit the cache or what ever it
is, fails to find what it is looking for and returns 404

This though is dependent on URL dispatch being somehow being dependent
on information in a cache.

Can you provide more details about what the URLs are targeting that
are returning 404. Are the something where the application itself
would return 404.

Consider using:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response

to log requests going into your application and determine if the 404
is coming from it.

I can think of no reason Apache/mod_wsgi itself would cause a 404 to
be returned during any startup phase.

Graham


On 11 November 2012 01:45, Gnarlodious gnarlodi...@gmail.com wrote:
 I get the same thing happening. My webapp takes a while to initialize, but
 meanwhile all requests get the error. Upon uploading a new version I run a
 curl command to make it start up, which minimizes the chance a user will get
 the error. I also notice that browsers are modernizing to be more
 standards-compliant, so that cache handling and request timeout can make a
 diagnosis difficult. Using the curl command to request the first page has
 the benefit of being more patient than a browser,  and no cache means
 obsolete pages are not returned.

 I can imagine in the future the mod_wsgi module will send a minimal http
 header to prevent the browser from showing an error or cached page during
 webapp startup.

 -- Gnarlie

 --
 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/-/84adKgNJM6IJ.

 To post to this group, send email to modwsgi@googlegroups.com.
 To unsubscribe from this group, send email to
 modwsgi+unsubscr...@googlegroups.com.
 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 modwsgi@googlegroups.com.
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.