PermGen space Out of Memory Error on production GAE Server

44 views
Skip to first unread message

Kurt Hartmann

unread,
Nov 15, 2015, 9:55:32 PM11/15/15
to Google App Engine
My web module is using automatic scaling with the default F1 server instance.  Yesterday, I noticed a PermGen, Out of Memorry server exception occurred in production.  This concerns me, because my users receive a blank screen when this error happens as the response to their web request, and it will cause a lot of confusion.  Also, my app is in a pilot phase and there are just a couple of users and no load, so to receive a permgen, OutOfMemory server exception means more could be on the way as things ramp up.

Is there a way to increase the max PermGen memory allocation on a google app engine configuration?  I've searched and not found anything about changing the setting on a production app engine server (only development server, which I've done successfully).  If I change the server I'm using to something with more memory (e.g. F2 server instance), will that help?  I'm assuming that even a higher memory server instance will still use the default max permGen setting, so I don't think so. 

Thanks for letting me know how to reduce the possiblity of receiving these OutOfMemory errors in production google app engine servers.

Here's the stack trace of the error

http://mydogscores.com/events/viewMyDogScoresCalendar java.lang.OutOfMemoryError: PermGen space at sun.misc.Unsafe.defineClass(Native Method) at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63) at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399) at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:396) at java.security.AccessController.doPrivileged(Native Method) at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:395) at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:46) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2040) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1936) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1462) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:417) at java.util.HashMap.readObject(HashMap.java:1182) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2040) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1936) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1462) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2140) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2064) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1936) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1462) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:417) at com.google.apphosting.runtime.SessionManagerUtil.deserialize(SessionManagerUtil.java:56) at com.google.apphosting.runtime.MemcacheSessionStore.getSession(MemcacheSessionStore.java:38) at com.google.apphosting.runtime.jetty.SessionManager.loadSession(SessionManager.java:330)

Nick (Cloud Platform Support)

unread,
Nov 16, 2015, 6:48:07 PM11/16/15
to Google App Engine
Hey Kurt,

A question like this, of a technical nature on a specific issue, should instead be posted to Stack Overflow. This allows you to contact a much-wider group of potentially-helpful people, including a significant number of Googlers who monitor various sponsored tags there. 

As for specific technical help which could help you either solve the issue or make a better post to Stack Overflow, here are some of my thoughts:

  • Have you investigated the common causes of this kind of issue, and do you have any potential insights in regard to the Java memory structure and PermGen space?
  • Can you inspect the memory load periodically, for example during the start and end of requests, etc.? 
  • Could you provide more information about your most-likely memory-use patterns, or what kind of work you're doing? 
  • What's causing you to dynamically generate classes like this?
  • Have you tried merely upgrading instance class?
I wish you the best of luck in moving on to build a good Q&A for Stack Overflow, where you will find a significant user-base of people who can help. This forum is meant for more general discussion, not necessarily connected to specific issues.
Reply all
Reply to author
Forward
0 new messages