Hi, Tasks sometimes run multiple times; that's why they should be idempotent. The docs say 'in exceptional cases,' but myself and others see tasks (even named tasks!) execute multiple times during 'normal' processing. It is generally not frequent, but it happens. http://code.google.com/appengine/docs/python/taskqueue/overview.html#Task_Execution
Is the task named? If your code retries and the task was enqueued you would get a TaskAlreadyExists or Tombstoned task error. You might add a logging call before the task insert so you'll know if it tried more than once. Robert On Fri, Feb 18, 2011 at 02:38, pdknsk <[email protected]> wrote: > I've got an hourly cron, which inits a task. This works well, but I > just noticed for the second time this week what is very likely a bug. > > 0.1.0.1 - - [17/Feb/2011:23:00:00 -0800] "GET /task/init HTTP/1.1" 200 > ms=22 > 0.1.0.2 - - [17/Feb/2011:23:01:43 -0800] "POST /task/get HTTP/1.1" 200 > ms=103318 > 0.1.0.2 - - [17/Feb/2011:23:03:35 -0800] "POST /task/get HTTP/1.1" 200 > ms=79921 > > As you can notice, the first tasks runs perfectly fine, returns 200, > but is triggered again shortly after the first task finishes. When I > noticed it earlier this week, the task repeated itself twice. > > 0.1.0.1 - - [15/Feb/2011:02:00:00 -0800] "GET /task/init HTTP/1.1" 200 > ms=11 > 0.1.0.2 - - [15/Feb/2011:02:01:39 -0800] "POST /task/get HTTP/1.1" 200 > ms=98873 > 0.1.0.2 - - [15/Feb/2011:02:06:24 -0800] "POST /task/get HTTP/1.1" 200 > ms=79494 > 0.1.0.2 - - [15/Feb/2011:02:15:58 -0800] "POST /task/get HTTP/1.1" 200 > ms=80873 > > I've got a suspicion on what could be the problem, if it's not a bug. > In the request handler for the cron, I retry to add the task up to 5 > times with delay if taskqueue.add fails. Could it be that > taskqueue.add adds the task successfully, but mistakenly also raises > an exception? Which would still be a bug though. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" 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?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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?hl=en.
