Include your whole handler file if possible. It is very hard to debug by guessing about your code.
Robert On Mon, Aug 1, 2011 at 16:43, piased <pranavade...@gmail.com> wrote: > > > On Jul 18, 8:46 pm, "Nick Johnson (Google)" <nick.john...@google.com> > wrote: >> Hi, >> >> You are missing this stanza from the end of your handler script: >> >> if __name__ == '__main__': >> main() >> > > I do have that in the handler. The above was a snippet from the > script. Without that I don't think it would work, which is not the > case for me since it works the very next time. > > After a bit more trial-error it seems like that this is happening > after the instance in gone (as seen from the dashboard, number of > instances stats). So, after having got successful response by fetching > it multiple times as mentioned above, if I wait for some more time > (few mins.) I can again get the zero response and that correlates > perfectly to the time the instance is gone. > > Also, I found few mentions for "warmup requests" and "loading > requests". These are primarily in reference to high latency and not > zero byte, but maybe they are related ? > > Right now I just re-issue the request in my startup code if the > response is blank ... works for me, but not the best solution. > > > >> This instructs Python to execute your main function on initial import. >> >> -Nick Johnson >> >> >> >> On Thu, Jul 14, 2011 at 11:01 AM, piased <pranavade...@gmail.com> wrote: >> > Hello All, >> >> > I have a simple app which requires login. But instead of redirect the >> > user directly to google login I have a link on my main page for Sign >> > In. This page is generated as follows: >> >> > class Login(webapp.RequestHandler): >> > # GET /login >> > def get(self): >> > user = users.get_current_user() >> > if not user: >> > self.response.out.write("Not signed in ") >> > self.response.out.write('<a href="%s">Sign In</a>' % >> > (users.create_login_url('/'))) >> > else: >> > self.response.out.write('Hello, %s ' % (user.nickname())) >> > self.response.out.write('<a href="%s">Sign Out</a>' % >> > (users.create_logout_url('/'))) >> >> > So the response is pretty small, a few bytes. But if I do a wget to >> > the above link it give zero bytes in response the first time I fetch >> > it, on subsequent tries is works fine. >> >> > From the logs I see the following message in the first request >> > """ >> > This request caused a new process to be started for your application, >> > and thus caused your application code to be loaded for the first time. >> > This request may thus take longer and use more CPU than a typical >> > request for your application. >> > """ >> > Whereas there is no such message in the second request which works. >> >> > Is there something I am missing or is appengine trying to do something >> > for small responses and screwing up especially for new instances ? >> >> > I would appreciate any help. >> >> > Thanks >> > -- Pranav >> >> > P.S. >> >> > Here are the headers for the zero byte response: >> > HTTP request sent, awaiting response... >> > HTTP/1.0 200 OK >> > Date: Thu, 14 Jul 2011 00:25:29 GMT >> > Content-Type: text/html >> > Server: Google Frontend >> > Content-Length: 0 >> > Connection: Keep-Alive >> > Length: 0 [text/html] >> >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "Google App Engine" group. >> > To post to this group, send email to google-appengine@googlegroups.com. >> > To unsubscribe from this group, send email to >> > google-appengine+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> >http://groups.google.com/group/google-appengine?hl=en. >> >> -- >> Nick Johnson, Developer Programs Engineer, App Engine > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to google-appengine@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.