[Geoserver-users] java.lang.OutOfMemoryError: Java heap space problems when displaying multiple layers

What I am trying to do is display several layers using openlayers and geoserver. This includes 1 Google Map layer and 2 WMS layers as outlined in attached picture. Code was modified from provided example.

However when I try this and use the map for a little while I get “java.lang.OutOfMemoryError: Java heap space” errors on both the map and in the console which is running geoserver.

I tried this in both the 1.7.0 and latest-trunk builds and the problem occurs in both.

It appears to work fine when I remove my wms layer which has a custom style applied. The other layer simply uses the polygon layer which comes with geoserver.

Custom Style

<?xml version="1.0" encoding="ISO-8859-1"?>

Default Line A boring default style A sample style that just prints out a green line Rule 1 Green Line A green line with a 2 pixel width #319738 2 Variety Times New Roman Normal 16 bold #FF0000

This style works fine when i just open it using the map preview page.

Any help with this would be much appreciated.

Brad


Bradley Mclain
Systems Administrator Trainee
De Bortoli Wines Pty limited
De Bortoli Rd, BILBUL NSW 2680
e: bradley_mclain@anonymised.com

java-memory-problem.jpg

Bradley McLain ha scritto:

What I am trying to do is display several layers using openlayers and geoserver. This includes 1 Google Map layer and 2 WMS layers as outlined in attached picture. Code was modified from provided example.

However when I try this and use the map for a little while I get "java.lang.OutOfMemoryError: Java heap space" errors on both the map and in the console which is running geoserver.

I tried this in both the 1.7.0 and latest-trunk builds and the problem occurs in both.

I second Stefan, it's most probably an issue with the permanent
generation memory setup. Are you running other apps alongside GeoServer
in the same web container?
Do you have a log of the full exception stack trace? It can be found
in the geoerver data directory logs/geoserver.log

Anyways, feeding your JVM with "-Xms48m -Xmx256M -XX:MaxPermSize=128m"
extra params should do the trick in most cases

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thanks adding those commands to the startup script appears to have fixed the problems for now.

Would just like to say after returning to Geoserver after about a year break (we are testing various GIS packages), the progress Geoserver has made in recent versions is excellent, well done!

Brad

2008/11/25 Andrea Aime <aaime@anonymised.com>

Bradley McLain ha scritto:

What I am trying to do is display several layers using openlayers and geoserver. This includes 1 Google Map layer and 2 WMS layers as outlined in attached picture. Code was modified from provided example.

However when I try this and use the map for a little while I get “java.lang.OutOfMemoryError: Java heap space” errors on both the map and in the console which is running geoserver.

I tried this in both the 1.7.0 and latest-trunk builds and the problem occurs in both.

I second Stefan, it’s most probably an issue with the permanent
generation memory setup. Are you running other apps alongside GeoServer
in the same web container?
Do you have a log of the full exception stack trace? It can be found
in the geoerver data directory logs/geoserver.log

Anyways, feeding your JVM with “-Xms48m -Xmx256M -XX:MaxPermSize=128m”
extra params should do the trick in most cases

Cheers
Andrea


Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.


Bradley Mclain
Systems Administrator Trainee
De Bortoli Wines Pty limited
De Bortoli Rd, BILBUL NSW 2680
e: bradley_mclain@anonymised.com

We kept running out of permgen space in the dev environment, but the
prod environment was fine. It seems to be fixed now - the problem is
that loaded java classes never get cleared from memory (hence the "perm"
in "permgen"), so when you redeploy multiple times to a web container
without bouncing the JVM, eventually it fills up.

Try using these java options
  -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled

Note that this problem is specific to the Sun JVM, and only occurs when
you deploy multiple times (which you typically do while developing).

-----Original Message-----

I second Stefan, it's most probably an issue with the permanent
generation memory setup. Are you running other apps alongside GeoServer
in the same web container?
Do you have a log of the full exception stack trace? It can be found in
the geoerver data directory logs/geoserver.log

Anyways, feeding your JVM with "-Xms48m -Xmx256M -XX:MaxPermSize=128m"
extra params should do the trick in most cases

------
If you have received this transmission in error please notify us immediately by return e-mail and delete all copies. If this e-mail or any attachments have been sent to you in error, that error does not constitute waiver of any confidentiality, privilege or copyright in respect of information in the e-mail or attachments.

Please consider the environment before printing this email.

------

Murray, Paul ha scritto:

We kept running out of permgen space in the dev environment, but the
prod environment was fine. It seems to be fixed now - the problem is
that loaded java classes never get cleared from memory (hence the "perm"
in "permgen"), so when you redeploy multiple times to a web container
without bouncing the JVM, eventually it fills up.

Try using these java options
  -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled

Note that this problem is specific to the Sun JVM, and only occurs when
you deploy multiple times (which you typically do while developing).

Aah, right, thanks for the tip!
I've added in the "geoserver in production" page:
http://geoserver.org/display/GEOSDOC/2.6+GeoServer+in+Production+Environment

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.