Thanks for the response Don.
I would suggest altering the page
http://code.google.com/intl/en/appengine/docs/java/runtime.html to
clarify this.
Thanks again,
Esteban
El 16/02/2010 13:08, Don Schwarz escribió:
We don't currently make any guarantees about throwing
DeadlineExceededException or HardDeadlineExceededError if you're in a
tight CPU loop.
We may in the future, but for the moment please only rely on getting
notifications of deadlines if you're doing one of the following:
a) periodically making API calls,
b) periodically doing I/O (e.g. loading data from files), or
c) sleeping.
On Mon, Feb 15, 2010 at 10:58 AM, Esteban Masoero
<[email protected] <mailto:[email protected]>> wrote:
yes, I'm sure I'm not catching anything.
In fact, I did some tests and find out that most of the time the
deadline exception is not thrown when executing some code (untill
now the deadline exception only happened once), but It is always
thrown when you are doing something like sleep(). If you are
executing some code, then most of the time I only get a message of
"Error: Server Error" with status code 500 (and strangely the log
doesn't say anything this time, but I guess is still the
HardDeadlineExceededError).
Here's the code:
public class SimpleServlet extends HttpServlet {
private static final long serialVersionUID =
-3775863594932985057L;
@Override
protected void doGet(HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException {
try {
int time = req.getParameter("sleep") != null ?
Integer.valueOf(req.getParameter("sleep")) : 40;
resp.getWriter().println("Sleeping " + time + "
seconds...");
Thread.sleep(time * 1000);
resp.getWriter().println("Interating infinitly...");
int i = 0;
boolean b = true;
while (b) {
i++;
}
} catch (InterruptedException e) {
System.out.println("InterruptedException");
resp.getWriter().println("InterruptedException");
} catch (DeadlineExceededException e) {
System.out.println("DeadlineExceededException");
resp.getWriter().println("DeadlineExceededException");
} catch (Throwable e) {
System.out.println("Catch throwable");
resp.getWriter().println("Catch throwable");
}
}
@Override
protected void doPost(HttpServletRequest req,
HttpServletResponse resp) throws ServletException, IOException {
this.doGet(req, resp);
}
}
I guess the deadline handling process ise still a bit immature and
we should not rely upon it.
Thanks,
Esteban
El 12/02/2010 18:40, John Patterson escribió:
I believe that the stack trace from a HDEE is not accurate. I
found that it seemed to be copied from the first DEE. Are you
sure you are not catching and ignoring this first?
On 12 Feb 2010, at 22:24, Esteban Ignacio Masoero wrote:
Hi there:
I'm facing the same problem. I tried and I tried and I still
can't catch any deadlineException that is supossed to be thrown
when I exceed the 30 seconds. The only thing I see is a
HardDeadlineExceededError, and in my case it ocurrs in the
middle of a JDOQuery.deletePersistentAll() method.
Anyone has any ideas? All I want to do is make sure that I'm
handling that situation in case it happens. Here's the stack:
com.google.apphosting.runtime.HardDeadlineExceededError: This
request (ccc45fc5ce7541bd) started at 2010/02/12 14:51:12.763
UTC and was still executing at 2010/02/12 14:51:42.551 UTC.
at
com.google.appengine.runtime.Request.process-ccc45fc5ce7541bd(Request.java)
at sun.misc.Unsafe.park(Native Method)
at java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(Unknown
Source)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(Unknown
Source)
at java.util.concurrent.CountDownLatch.await(Unknown Source)
at
com.google.net.rpc.util.RpcWaiter.waitForRpcsToFinish(RpcWaiter.java:96)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:98)
at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:48)
at
com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:52)
at
com.google.appengine.api.datastore.DatastoreServiceImpl$3.run(DatastoreServiceImpl.java:225)
at
com.google.appengine.api.datastore.TransactionRunner.runInTransaction(TransactionRunner.java:30)
at
com.google.appengine.api.datastore.DatastoreServiceImpl.delete(DatastoreServiceImpl.java:211)
at
com.google.appengine.api.datastore.DatastoreServiceImpl.delete(DatastoreServiceImpl.java:192)
at
com.google.appengine.api.datastore.DatastoreServiceImpl.delete(DatastoreServiceImpl.java:184)
at
org.datanucleus.store.appengine.RuntimeExceptionWrappingDatastoreService.delete(RuntimeExceptionWrappingDatastoreService.java:141)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.delete(DatastorePersistenceHandler.java:196)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.deleteObject(DatastorePersistenceHandler.java:612)
at
org.datanucleus.state.JDOStateManagerImpl.internalDeletePersistent(JDOStateManagerImpl.java:4198)
at
org.datanucleus.state.JDOStateManagerImpl.deletePersistent(JDOStateManagerImpl.java:4166)
at
org.datanucleus.ObjectManagerImpl.deleteObjectInternal(ObjectManagerImpl.java:1470)
at
org.datanucleus.ObjectManagerImpl.deleteObject(ObjectManagerImpl.java:1395)
at
org.datanucleus.ObjectManagerImpl.deleteObjects(ObjectManagerImpl.java:1534)
at
org.datanucleus.store.query.Query.performDeletePersistentAll(Query.java:1881)
at
org.datanucleus.store.query.AbstractJavaQuery.performDeletePersistentAll(AbstractJavaQuery.java:136)
at
org.datanucleus.store.query.Query.deletePersistentAll(Query.java:1832)
at
org.datanucleus.store.query.Query.deletePersistentAll(Query.java:1780)
at
org.datanucleus.store.query.Query.deletePersistentAll(Query.java:1769)
at
org.datanucleus.jdo.JDOQuery.deletePersistentAll(JDOQuery.java:159)
at ar.com.SomeCodeOfMine$8.doStuff(Blah.java:175)
Thanks,
Esteban
On Thu, Dec 24, 2009 at 4:24 AM, Lior Harsat
<[email protected] <mailto:[email protected]>> wrote:
Hi Don,
thanx for your quick reply.
I am pretty sure I am not catching DeadlineExceededException
anywhere
in the code (but I'll check again...).
I've seen some posts in the past and some bugs submitted to
google
code that there is an inconsistent behavior with regard to the
deadline error/exception.
Thanx,Lior
On Dec 23, 10:36 pm, Don Schwarz <[email protected]
<mailto:[email protected]>> wrote:
> You cannot catch HardDeadlineExceededError.
DeadlineExceededException
> should be thrown first.
>
> Perhaps some code you are using is silently catching and
ignoring it?
>
>
>
> On Wed, Dec 23, 2009 at 4:08 AM, Lior Harsat
<[email protected] <mailto:[email protected]>> wrote:
> > Hi,
>
> > I am trying to build some mechanism for handling
> > HardDeadlineExceededError (and other timeouts as well).
> > I wish to catch this Error and wrap up my work so I can
send my own
> > response instead of the default error (500) message that
GAE produces.
> > Here's the problem. I cant catch this Error for some
reason.I've made
> > sure my catch clause is in the right place (from the
error provided
> > stack trace). I even catch a Throwable to make sure I
don't miss the
> > Error.
> > Sadly I don't reach the catch clause.
>
> > Has anyone had some experience with this?
> > Do you have some other innovative ideas on how to handle
such
> > timeouts ?
>
> > B.T.W
> > I would have expected that a DeadlineExceededException
would be thrown
> > instead , dont you?
>
> > Thanx, Lior
>
> > --
>
> > You received this message because you are subscribed to
the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > [email protected]
<mailto:[email protected]>.
> > To unsubscribe from this group, send email to
> > [email protected]
<mailto:google-appengine-java%[email protected]><google-appengine-java%2B
[email protected]
<mailto:[email protected]>>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the
Google Groups "Google App Engine for Java" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:google-appengine-java%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the
Google Groups "Google App Engine for Java" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:[email protected]>.
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the
Google Groups "Google App Engine for Java" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:[email protected]>.
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Google App Engine for Java" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:google-appengine-java%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the Google
Groups "Google App Engine for Java" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.
--
You received this message because you are subscribed to the Google Groups "Google
App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.