How to set max Permgen settings in production Google App Engine server

2 views
Skip to first unread message

Kurt Hartmann via StackOverflow

unread,
Nov 16, 2015, 10:14:05 PM11/16/15
to google-appengin...@googlegroups.com

I am running a web module on google app engine 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

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)



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/33748480/how-to-set-max-permgen-settings-in-production-google-app-engine-server

Kurt Hartmann via StackOverflow

unread,
Nov 17, 2015, 3:24:10 AM11/17/15
to google-appengin...@googlegroups.com

Patrice via StackOverflow

unread,
Nov 20, 2015, 10:04:10 AM11/20/15
to google-appengin...@googlegroups.com

The only way to get more control into the instance that is hosting your application is to use Managed VMs.

While minimizing user session could help in this instance, it's not always easy and not guaranteed (since you can minimize but still hit the limit).

Be careful about using managed VMs (remember they scale differently too, so make sure to read about this, especially the scaling section), since they are still in Beta, which means they shouldn't be used in production for critical applications.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/33748480/how-to-set-max-permgen-settings-in-production-google-app-engine-server/33829827#33829827
Reply all
Reply to author
Forward
0 new messages