Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 993
doppelgreener Avatar asked Jun 01 '10 06:06

doppelgreener


2 Answers

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

like image 126
Jon Skeet Avatar answered Sep 22 '22 14:09

Jon Skeet


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.

like image 24
Peter Recore Avatar answered Sep 21 '22 14:09

Peter Recore