out of memory error for Servoy 2.2.4

Hi there,

Our Servoy Apps server was running fine for a few days until we hit a “out of memory” error. None of the clients are able to connect. Our server has over 2 gigs of memory.

I’ve attached a screenshot of our servoy apps setting as well as our server memory available screen.
The log file also logged the issue and is attached.

Servoyians, please help!

Thanks,
sammy

Settings:

Server Information
Servoy version R2 2.2.4-build 336, repository version 27
java.vm.version=1.4.2_05-b04
os.name=Windows 2000
Running MS SQL server 2000

servoy_out of memory.doc (217 KB)

servoy-outofmemory.txt (175 KB)

sammyzheng:
Hi there,

Our Servoy Apps server was running fine for a few days until we hit a “out of memory” error. None of the clients are able to connect. Our server has over 2 gigs of memory.

By default, Java will only use a maximum of 64 megabytes. In Servoy 2.2, the default is used. You can either upgrade to Servoy 3 or change the servoy_server.bat file that you use to start the server.

This is how to change the .bat file: open in an editor (notepad would do) and find the line that starts with ‘java’. Add ‘-Xmx256m -Xms64m’ right after ‘java’ so you get:

java -Xmx256m -Xms64m -Djava.awt.headless=true -classpath (and then a lot more stuff)

Save the file and restart Servoy Server. Now Servoy Server will use up to 256 megabytes of memory.

Thanks for the tip: Since this is a production environement, i’ll have to wait until weekend to restart the server. Upgrade to 3.0 is not an option for us right now.
Couple more questions.

  1. Can we do it directly in the servoy web-admin page?
  2. How do we know we’ve changed it successfully? Is there some indicator?

sammyzheng:
Couple more questions.

  1. Can we do it directly in the servoy web-admin page?
  2. How do we know we’ve changed it successfully? Is there some indicator?
  1. No, unfortunately you cannot change it in the web-admin page. You’ll have to edit the .bat file manually.

  2. In the web-admin page entry screen, Servoy Server shows the amount of memory used. If it’s greater than 64MB, it worked. If it isn’t, unfortunately all you know is it doesn’t need that much at the moment. You could launch some clients of course, to see if you can get it past that 64 meg boundary.

which exact screen am I supposed to see the 64MEG upgraded to 256Meg? is it the "servoy.maxClientHeap: " . I tried doing what you said
to add the -Xmx256m -Xms64m to the java line, but it still says 64 meg on the maxclient heap?

below is my servoy_server.bat file txt

@echo off

:restart
rem To enable logging change ‘java’ into ‘java -DSTACKTRACE=true’
java -Xmx256m -Xms64m -Djava.awt.headless=true -classpath .;lib\commons-collections.jar;lib\commons-dbcp.jar;lib\commons-pool.jar;lib\activation.jar;lib\antlr.jar;lib\j2db.jar;lib\j2dbdev.jar;lib\compat141.jar;lib\jndi.jar;lib\js.jar;lib\jta.jar;lib\mail.jar;lib\jug.jar;lib\jdbc2_0-stdext.jar;lib\naming-common.jar;lib\naming-resources.jar;lib\servlet.jar;lib\xerces.jar;lib\server-bootstrap.jar;lib\commons-fileupload-1.0.jar;lib\commons-logging.jar;lib\hibernate2.jar com.servoy.j2db.server.ApplicationServer %1 %2 %3 %4 %5 %6 %7 %8 %9

rem loaded by tomcat it self: server\lib\catalina.jar;server\lib\jakarta-regexp-1.2.jar;server\lib\jasper-compiler.jar;server\lib\jasper-runtime.jar;server\lib\naming-factory.jar;server\lib\servlets-common.jar;server\lib\servlets-default.jar;server\lib\servlets-invoker.jar;server\lib\servlets-manager.jar;server\lib\servlets-snoop.jar;server\lib\servlets-webdav.jar;server\lib\tomcat-ajp.jar;server\lib\tomcat-util.jar;server\lib\warp.jar

rem restart if the server exited with the restart exit code 99
if errorlevel 99 goto restart

This problem occured twice(before I put in the -Xmx256m code)

I’m still unsure how we can verify that my fix works and increased the servoy Apps server to use more than 64 megs of ram? I cannot afford another “crash” and halt my production environment again. I’m under some great pressure here…

I’m only talking about having 50 concurrent users on a Dual CPU 2 gig of ram Windows 2000 server. We have plans to roll out to 100 users eventually. How can we get these “out of memory” errors??? aren’t servoy server built to handle large client base?

Hi sammy,

here you see how much memory Servoy server is using.
if you start the server (as you mentioned) with the extra options, the allocated and used memory will automaticly grow.

As Sander said, you can only see that, if the memory grows. not instantly.

Hope this helps.

mem.GIF

HJK:
Hi sammy,

here you see how much memory Servoy server is using.
if you start the server (as you mentioned) with the extra options, the allocated and used memory will automaticly grow.

As Sander said, you can only see that, if the memory grows. not instantly.

Hope this helps.

Hi there HJK,
1)I’m using servoy 2.2.4; I know that on servoy 3.0, it shows that statistic, but on 2.2.4, it doesn’t on the web-admin page. Is there a way I can confirm since I have the lower version? I just can’t afford to wait until another “out of memory” crash again.

2)Also, are you saying that with this code: “java -Xmx256m -Xms64m -Djava.awt.headless=true” in place, the memroy allocation will automatically take care of it self? Why wouldn’t it be a default for servoy apps server.

Sorry for these silly quesitons, but I just want to make sure and get a confirmation that my code was started properly.

Thanks all,
sammy

the screenshot you saw is from servoy 2.2.7
So I think you can’t see it, but have to trust that is works.

One more question, When I changed the servoy_server.bat file, do I have to double-click on the servoy_server.bat file to run it? or is simply starting and restarting the service using Windows Service or Web-admin tool enough to make the change effective?

I really wish there was a way to verify the memory check worked. If this happens again, I’ll have a lot of explaning to do

sammyzheng:
One more question, When I changed the servoy_server.bat file, do I have to double-click on the servoy_server.bat file to run it? or is simply starting and restarting the service using Windows Service or Web-admin tool enough to make the change effective?

Restarting Servoy server is enough.

oh wait, you are starting the server by the windows services?
than the bat-file will do nothing for you!!!

than you must search for a file: wrapper.conf in the service folder

search for this:

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=3

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=256

adjust the maximum java heap size for your needs

than restart the server.

hope that helps

HJK. THANKS so much for the information! that’s exactly what I needed to know.

Do you know also know if 512MB RAM max on server is enough to support about 70-100 total concurrent clients?

I’ve also changed the servoy.maxClientHeap: to 128 from 64 per Bob Cusick’s instructions.

hopefully doing both things will really address the out of memory error.

You guys are great!