As mentioned, this can sometimes occur if you begin exhausting instance memory. You could try to do one of the following actions to alleviate such a problem:
- If your task processing contains a loop, on each iteration (or every N iterations, or even using time-based logic if you'd like), you can test the amount of memory usage and back off on processing / shift a portion of procession to another instance if you're getting too close to the limit. You could also use (for manual scaling instances), a background-thread <https://cloud.google.com/appengine/docs/java/modules/#Java_Background_threads> to monitor this. - Break the task into smaller portions and distribute them among instances which can handle the load - Determine whether it truly is memory exhausting causing the instances to spin down by combining your own profiling with the information available from the Developers Console logs view. - Inspect your code to determine where possible "painful" situations can occur for memory, where you're perhaps loading the entire contents of a large file into memory. With these methods, you'll be able to either narrow down how to fix your memory issue, or determine that the issue isn't memory exhaustion. I'm curious as to what you mean by "calling ofy().clear() sometimes did not solve anything". Does this mean that it did seem to, at least somewhat, alleviate the problem? Also, yes you should be using the static import ofy() method as the docs describe, not holding onto any objects of type Objectify. Best wishes, Nick On Wednesday, June 24, 2015 at 4:54:19 PM UTC-4, nilsler...@gmail.com wrote: > > Thank you Chad Vincent for your answer. > > I added some logging, but it didn't gave me more relevant information. > Everything is running fine until the "unexplainable" failure. Therefore, I > guess that it is related to a memory issue. It retrieves data and caches > until the memory is full and then crashes. > > I spent some time tonight reading the Objectify documentation. I came > across this: > https://code.google.com/p/objectify-appengine/wiki/BasicOperations#The_Session_Cache > > . It could really be related to my issue. Unfortunately calling > ofy().clear() sometimes did not solve anything. Moreover, I read that > assigning ObjectifyService.ofy() was a bad idea. But requesting ofy() > directly each time I needed it did not help neither. > > Any other idea or suggestion is welcome. Thank you :) . > G. > > Le mercredi 24 juin 2015 22:30:38 UTC+2, Chad Vincent a écrit : >> >> Then I would definitely add more logging so you can see what is and is >> not getting done before the instance bails. >> >> On Wednesday, June 24, 2015 at 1:48:07 AM UTC-5, nilsl...@gmail.com >> wrote: >>> >>> Thank you for answering me. >>> >>> Here is the only log I'm getting : >>> /task/update-known-devices 500 151600ms 0kb AppEngine-Google; (+ >>> http://code.google.com/appengine) module=default version=dev >>> >>> 1. >>> >>> 0.1.0.2 - - [23/Jun/2015:23:23:07 -0700] "POST >>> /task/update-known-devices HTTP/1.1" 500 0 >>> "http://freemobile-netstat.appspot.com/cron/update-known-devices" >>> "AppEngine-Google; (+http://code.google.com/appengine)" >>> "freemobile-netstat.appspot.com" ms=151600 cpu_ms=3530 >>> queue_name=update-queue task_name=81805458203132447311 exit_code=202 >>> app_engine_release=1.9.22 trace_id=b86eb2915714ad73aae5f54bfbef746d >>> instance=00c61b117c5b3b509e154cd4930e3af3083a8a68 >>> <https://appengine.google.com/instances?app_id=e~freemobile-netstat&version_id=dev.385229375500191200&key=00c61b117c5b3b509e154cd4930e3af3083a8a68#00c61b117c5b3b509e154cd4930e3af3083a8a68> >>> >>> 2. E2015-06-24 08:23:07.492 >>> >>> A problem was encountered with the process that handled this request, >>> causing it to exit. This is likely to cause a new process to be used for >>> the next request to your application. (Error code 202) >>> >>> >>> This log appears for each retry (around 3 times per task). >>> >>> G. >>> Le mercredi 24 juin 2015 01:00:49 UTC+2, Chad Vincent a écrit : >>>> >>>> What are you getting in your logs? Any uncaught exceptions? >>>> >>>> You might want to add some debug logging statements and lower the >>>> logging level for a while to see what is happening. You do get 10 minutes >>>> for queries from the TaskQueue, so it isn't a timeout issue. >>>> >>>> On Tuesday, June 23, 2015 at 1:31:59 PM UTC-5, nilsl...@gmail.com >>>> wrote: >>>>> >>>>> Hi everybody, >>>>> I have a long task to run under my App Engine application with a lot >>>>> of computing. But after a while running the task (~2 minutes), it stops >>>>> and >>>>> just retries. Obviously, my task restarts from the beginning and cannot >>>>> end. >>>>> I would like to configure App Engine to run the task until it is >>>>> finished. I've heard about a 10 minutes limit for the tasks. I guess it >>>>> should be enough if it didn't retries everytime. >>>>> >>>>> My source code is (hopefully) freely available here : >>>>> https://github.com/gilbsgilbs/freemobilenetstat-gae . The two tasks >>>>> under *src/main/java/org/pixmob/freemobile/netstat/gae/web/task* are >>>>> problematic (since it computes a lot of data). They are pushed the the >>>>> queue from a cron under >>>>> *src/main/java/org/pixmob/freemobile/netstat/gae/web/cron/CronServlet.java* >>>>> . >>>>> >>>>> Note that I'm really new to App Engine and that my code might not be >>>>> optimal. I'm not sure of the exact issue and maybe it is just a memory >>>>> overflow (which I wouldn't known how to fix). >>>>> >>>>> Thank you ! >>>>> G. >>>>> >>>> -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-appengine+unsubscr...@googlegroups.com. To post to this group, send email to google-appengine@googlegroups.com. Visit this group at http://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/50f86405-c67c-4ec8-a6a0-836cadbd128c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.