Consequences of an infinite loop on Google App Engine? [closed]
Asked Answered
W

3

5

I am not a Google App Engine user. However, I understand you're billed for CPU time and other resources. What are the consequences if you happen to create an infinite loop? Will Google ever terminate it, or will you have to do it yourself manually somehow?

I'm a hobbyist developer worried about a small error that might end up costing hundreds.

Woaded answered 1/6, 2010 at 6:0 Comment(0)
L
7

(I'm a Google employee but have little experience with AppEngine. Please don't consider this an "official" response.)

I'm guessing you're using the Java servlet API - if not, please specify.

From the AppEngine servlet docs:

A request handler has a limited amount of time to generate and return a response to a request, typically around 30 seconds. Once the deadline has been reached, the request handler is interrupted.

I don't know how/whether this occurs in a tight-loop which wouldn't allow the VM to interrupt it in "normal" Java.

Lepper answered 1/6, 2010 at 6:5 Comment(3)
Thanks a lot, that's the sort of information I was after.Woaded
The tight loop may prevent the 'soft' deadline error being thrown, but the 'hard' one will still terminate your handler after 30 seconds. Also, stop muscling in on my turf, Jon. ;)Stewardson
Also, it doesn't matter if you are using the java or python versions. Both will cut you off after 30 seconds.Noble
N
3

While Jon handled the low level case of an infinite loop, there could also be a situation where one of your handlers is called repeatedly an excessive amount of times - perhaps you accidentally configure something to back up your entire datastore every second instead of once a day. Theoretically, you could use up a lot of resources, even in 30 second chunks. However, you would still not be in danger of racking up a huge amount of charges. You have the option of setting a limit on how much you want to "spend" per day. If you have no quota left, your app will return an error, not put you into debtor's prison.

Noble answered 1/6, 2010 at 19:52 Comment(2)
Setting a quota!? Oh wow, that's fantastic news! An internet and a +1 to you! What I am most worried about is infinite loops since they're fairly common, not so much excessive calls, though I can't say I actually considered that sort of resource hogging. I'll keep an eye out for that. Thanks Peter.Woaded
also, if you are just tinkering/testing, you can stay with the free quota. in that case, you will not have even given them any payment info, so you can sleep at night with no worries about infinite loops.Noble
K
1

Google AppEngine imposes a limit on how long a request may take before it is terminated,

There is a roughly 30 second limit imposed on how long a request must take before it is terminated. However, shortly before the process is terminated, a DeadlineExceededError exception will be thrown.

Additionally there are per-minute quotas to prevent the application from consuming too much quota in a short period of time. It is very unlikely that your application will exceed the per-minute quota under normal conditions, but, if needed an increase to this quota can be requested.

Kneepad answered 2/6, 2010 at 6:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.