开发者

google app engine HardDeadlineExceededError

I host my application on google app engine. What my application should do is every two minutes connects to a website, parses it and send the necessary info to my device using C2DM. I first tested my application to see if it works once. And it works fine. But inorder to check the webiste every two minutes I put the necessary methods in a while loop and then put Thread.sleep(120000) in the while loop. It wokred for a while but now I get this: Uncaught exception from servlet com.google.apphosting.runtime.HardDeadlineExceededError: This request (f6b9f0b8e1ec6f23) started at 2011/06/09 10:24:22.514 UTC and was still executing at 2011/06/09 10:24:52.824 UTC.

So before the two minute thing every thing was ok.

and this is the whole error message:

Uncaught exception from servlet
com.google.apphosting.runtime.HardDeadlineExceededError: This request (f6b9f0b8e1ec6f23) started at 2011/06/09 10:24:22.514 UTC and was still executing at 2011/06/09 10:24:52.824 UTC.

at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:408)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at java.lang.StringBuilder.<init>(StringBuilder.java:110)
at tripplannerServer.ParseVerstoring.parsePlanned(ParseVerstoring.java:50)
at tripplannerServer.SendMessage2.geplandeVerstoring(SendMessage2.java:257)
at tripplannerServer.TripplannerServerServlet.doGet(TripplannerServerServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:97)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.runtime.jetty.SaveSessionFil开发者_C百科ter.doFilter(SaveSessionFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:238)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
at com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:260)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime$2.handleRequest(RuntimePb.java:9669)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:439)
at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:573)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:448)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:688)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:326)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:318)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:446)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)

Any idea how to solve this? Or the idea to use Thread.sleep() is not good? If not how can I make the application check the website every two minutes?

Thank you in advance.


You shouldn't ever use Thread.sleep in an App Engine frontend, taskqueue, or cron request. Instead, schedule a cron job every two minutes, or chain Task Queue tasks with the appropriate ETAs.


Any front-end app should be finished in 30 sec(HardDeadline). You have basically 2 options,

  1. (better one)change your app logic, avoid Thread.sleep() and use cron.xml instead to start your app every x minutes. In your case, always-on or taskQueue simply won't help.
  2. change to Backends so you can run your app continuously.


we are getting such type of error when fetching time is exceeding more then 60 sec.

To solve this problem google app engine support the "cursor". By using the cursor you can fix the fetching limit,

if needed then you can implement inner cursor also i.e.(cursor inside the cursor)


I had this problem just the first time I try to load my web page after deploying my code in production. This first loading took a lot of time and therefore i got the error.

What worked for me was to change the Frontend Instance Class in Performance section in my Application Settings (under administration menu). I changed from F1 to F2 and the problem was fixed.

Once this first load is done, I go back to F1, because with the other options you consume much more frontend instances quota.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜