top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

Memory limits for children processes when running Tomcat as service?

0 votes
74 views

I have a JSF2.0 app that executes (via ProcessBuilder) an external script. This script opens PPTX via PowerPoint ActiveX object, manipulate it and save. It runs on Windows Server 2008 R2 64-bit, 4GB RAM, JDK 7.

When tomcat 7 is launched using startup.bat (with original settings), it works fine.

When tomcat runs as a service, opening the PPTX in the PowerPoint fails because of Out Of Memory error regardless Xmx settings (tomcat7w.exe).

I originally asked PowerPoint forum, but haven't get any explanation yet:
http://answers.microsoft.com/thread/37cbebf6-4003-4ab0-9295-92413aaecc2e

But as the entry point is Tomcat and the only difference between problematic and non problematic behavior is the 'service' mode, maybe there is something related in the tomcat7.exe code base. Just guessing.

Has anybody an idea why both modes behave differently?

posted Jun 26, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button
I forgot to mention that the Tomcat service is launched using my credentials (not as local admin). The same account I use for a remote access and hence for launching the tomcat via startup.bat.

I really do not see any differences. The same commands (cmd.exe, csript.exe, ...) are executed (64-bit variants) with the same params, but in one case there are memory limits.

Btw, could be there any memory differences between users? I'll rather double check this. But I don't know how :-(

What else... antivirus, firewall? I'll try to disable it for a while. AFAIK tomcat.exe is based on procrun wrapper. Is this wrapper memory safe?

I just think (aloud) I could write a custom wrapper and execute my script directly from this new service... Quite complex to me... But I could check if it behaves differently or not...

1 Answer

0 votes

The problem has nothing to do with Tomcat per se.
It is due to running a Microsoft Office program (or library modules such as the "Interop" series) as a sub-process of a Windows Service (and thus in the same Service context) which is something that is not in the design of Microsoft Office, not supported by Microsoft, and even actively discouraged by Microsoft.
See : http://support.microsoft.com/kb/257757

The problem is basically that a Windows Service does not run in the same "environment" as a "user session" environment, and as they say in that article, you will certainly experience "unstable behavior and/or deadlock" somewhere, and will get no help for it.

Personal experience : some things will work with one MS-Office program, and totally fail with another; even simple things like opening or saving a file. It may work with one file, and fail with another, for no apparent reason. You get an OOM error in this case, but other cases may be "file not found" (although it's there) or whatever other bizarre failures. Ultimately it is unpredictable, frustrating and time-consuming.

Solutions :
1) instead of MS-Office, use LibreOffice or OpenOffice. Both can run in "headless" mode, and provide an API to have them "do things with documents". And both can open and manipulate MS-Office documents. Depending on what you do, there may be some differences in the results, but it works fine for many things.
Or try one of the other solutions suggested in the above article. (I have not tried them, I use OpenOffice/LibreOffice).
2) do not run Tomcat as a Service. Create a virtual Windows machine, and run it in a user console (with startup.bat). You can restrict access to the VM, and since it is a VM, it can run unattended, just as a service would. (I am also using this scheme, when circumstances permit). But in that case, also pay attention to the licensing considerations at the end of the article.

answer Jun 26, 2013 by anonymous
Similar Questions
+2 votes

I'm receiving the following exception:

java.net.SocketException: "Permission denied": connect

when instantiating a Socket from a servlet:

final Socket smtpSocket = new Socket(mailTransportHost, mailTransportPort);

This application was running as a service under Windows Server 3003 R2 32-bits. After migrating it to Windows Server 2008 R2 64-bit, I cannot longer establish connection with the smtp server.

This only happen when running Tomcat as a service. Running as a standalone (starting it up using startup.bat) works fine. No exception instantiating Socket, emails are sent.

Environment:

 - Windows Server 2008 R2 64-bit
 - Tomcat 7.0.39
 - jdk1.6.0_33-x64
0 votes

I have two service running in tomcat. First service 'catalina' is having connector port 80, 443, 8080 and 8444. Second service 'catalina_advance' have connector port 8081 and 8444.

For catalina_advance, I entered a new tomcat access log file with configuration

when I hit the url http://ip-address:8081/context The port print in access log file is 8081
when I hit the url https://ip-address:8444/context  The port always print as 443.

Why this is happening

+1 vote

I have a websocket server endpoint in Tomcat and a Tyrus 1.7 client. When I try to send text messages from the Tyrus client to Tomcat, it appears that messages get dropped when sent at a rate greater than 1 every ten seconds. Is there configuration that limits the rate of messages from clients? Couldn't find in docs and I don't see it in source, but suspect it might be DOS prevention.

Perhaps this is a Tyrus limit, but please let me know if you know of limits or config in Tomcat.

+4 votes

Ive come into a strange problem using tomcat with one of our WAR file.The application works as a charm, but when using the manager to redeploy it, roughly one time out of two, the heap size explodes:

Please note that the _used_ heap does not - according to JVisualVM anyway. After that, everything hangs, and the tomcat stops responding, with CPU usage ranging from 60 to 100%. Also, this issue has been reproduced on several Tomcat version ranging from 7.0.32 to 8.0-RC5, and on several machines (all Windows though).

Could anyone direct me to the clues to look for?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...