JR Galia
JR Galia

Reputation: 17269

AppEngine/Java Cron DeadlineExceededException

I have cron setup in appengine project:

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
    <cron>
        <url>/cron/someurl</url>
        <description>cron</description>
        <schedule>every monday 8:00</schedule>
        <timezone>Asia/Singapore</timezone>
    </cron>
</cronentries>

I am getting the error:

com.google.apphosting.api.DeadlineExceededException: This request (40811df3b6350a70) started at 2012/11/26 00:00:00.404 UTC and was still executing at 2012/11/26 00:09:59.917 UTC.

It's a 1-minute limit to run the task? I though cron doesn't have that limit. How to avoid the error in cron entry?

Thanks.

Upvotes: 1

Views: 428

Answers (2)

Walter
Walter

Reputation: 51

Also you can try using task queues (10 minute maximun) and re-enqueue when you are near to time limit, using for that any state variable stored in datastore, or if you are depending of a iteration in datastore you can pass the datastore cursor to the other re-enqueued task. For me that works very well.

Upvotes: 1

Romin
Romin

Reputation: 8816

An HTTP request invoked by cron can run for up to 10 minutes, as per the documentation. If you notice the exception log closely in the HH:MM:SS value, you will find that a total of 10 minutes have passed since the job was started.

You might want to look at your code to see why it is taking that long. In case you have requirements that make your tasks run longer than 10 minutes, I suggest that you look at trapping the exception and then inserting another request to run a job with some request parameter that tells the job to start from where it left off last time.

Alternately, you could also look at Backends.

Upvotes: 4

Related Questions