You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by honyk <j....@email.cz> on 2013/06/26 20:27:10 UTC

Memory limits for children processes when running Tomcat as service?

Dear All,

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?

Thanks, Jan





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory limits for children processes when running Tomcat as service?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Jan,

On 6/26/13 2:27 PM, honyk wrote:
> 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?

Is it Tomcat that dies or the sub-process? Do you get a stack trace?
If so, post it. Do you get a core dump? If so, post it (at least the
back-trace of the offending thread).

What actually happens, here?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRy0rcAAoJEBzwKT+lPKRYqrIP/AmwKGRflEpEJvhihkCCzExv
XzofHf/Z38uVJ2lPUhsyxcQLX6zjlMNads4vnq0CaFoGY3b/7lQxyj5LNDZ+TxVC
NJzFgO1ZINTpr7YRw8AywaqKrlPRUWqSsWQq2pcAHQhHNq4DbAbUEynyxX0m7TBG
q7XgJZTm6jrh2jm9xBYrnx9q0yid8ytpJ7Gu1yNCF4NHTPLpUKyR3IHyJDW1w6Bs
kQfnGqlq0urAqin00iU1JrsOdsKoyqGzzR1vUuqwPOpnZ/tWhWBxCppjoKIxPTC3
/763n0W26YizKDtJ7NcKoD3XjiuWC8HC4yboKiekJj5dvjffurPx49z3XTiOoPIg
9f9JcYtzJxl0yhu0by5GuFfCz5YcxBl53Pf0AHFgcEyw6kcgbtEe992ckobNa0LS
CVwLSIEiJUBIcc0pO+BQ+lbtNiB9AYQTd0UNScbwBuwywxse1mGoXC4ShanrcCxh
AzVFc2LTxwk2wlO/KHUigZVsBMzNi9RyygpYyMx/Qn5hFN7Kmuly/qRoKNs/792p
69NorGkM5/EqhRCAk7K8tiInghG3SjWsoQ6ux6RI9TgbYA7O08u2mrsDd5DGx9dT
8T0uXpZv6WRlgqC+VpgDCvI/eYJ6y7fAbTdpdDLnlOGHSvPt3ECQrO+IWiYVUwm/
kNURqQy8YrPgqp9Q0Rg1
=jbwa
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Memory limits for children processes when running Tomcat as service?

Posted by honyk <j....@email.cz>.
On 2013-06-26 Jeffrey Janner wrote:
> > -----Original Message-----
> > From: honyk [mailto:j.tosovsky@email.cz]
> > Sent: Wednesday, June 26, 2013 1:27 PM
> > To: 'Tomcat Users List'
> > Subject: Memory limits for children processes when running Tomcat as
> > service?
> >
> > Dear All,
> >
> > 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?
> >
> > Thanks, Jan
> 
> What user is the Tomcat service running under?
> What other differences could exist between a user session (running with
> startup.bat) and a background session?

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...

Jan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Memory limits for children processes when running Tomcat as service?

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: honyk [mailto:j.tosovsky@email.cz]
> Sent: Wednesday, June 26, 2013 1:27 PM
> To: 'Tomcat Users List'
> Subject: Memory limits for children processes when running Tomcat as
> service?
> 
> Dear All,
> 
> 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?
> 
> Thanks, Jan

What user is the Tomcat service running under?
What other differences could exist between a user session (running with startup.bat) and a background session?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory limits for children processes when running Tomcat as service?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Martin,

On 6/27/13 3:44 PM, Martin Gainty wrote:
> When you run your MS app standalone how much heap, stack does this 
> process occupy?
> 
> When TC startsup how much heap,stack is left over for the
> standalone Microsoft app?

Read the documentation for java.lang.System.exec() and for the exec()
family of calls in the C library, and you'll realize that your
questions are irrelevant.

> If you're not going to powerup your machine with 8GB RAM and at
> least tera of storage your only solution

What in the world are you talking about?

> is to configure your Microsoft Compound Documents be opened, read 
> and written using POI https://poi.apache.org/

*rolls eyes*

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRzJ0eAAoJEBzwKT+lPKRY0W0QALzPstrnKUDpTAwrekAX6yIN
GRULhX8DE5EMcRQ0Z9TVYDj5Z2FaIOQebIERAeqz23g/v/F/C6jXeFMZtYQh80Rv
Chtbm8TyN620N7Y7ghQe4P8AQDfaez/Xj4DRQy+StGwQjkpo0zK9o03DpsfSuPqv
wpZtnoL8c8xaQx07i7O4qhyBnrXEJOJyPqvJyFuHDIosQHc4T/ksJPTKqaDFbRnO
HWqCV2B4DgwaTg708SjWG+3j3gysLxtDLJFUNyYR2oaRyAKbl5HthvE8kQYEbpQT
tYGoZlDSf9FV4tbADcWKprLi1krkvwh9unIoKeSABW4N4tE30s4S8bXzzPbyvVnI
ZBEX/eAzyXCNBdf7v/X9Vztj6N0KjpYzuqwA1nn53F/zZJeO7rfrvkT9HgHmgsYj
C2hw9f2G9OKO+Bn53Fw/6CNCBqB/ifT1sBU+IuubBUysuG2ECKs8lf13jVy1J4R+
a/OGq0VnVBZt6mo93gQPI9x308chQGkH3z/dNVekruuRSPq1Rb7QakvxGOGtJ2kv
2S8Qp+ixbI4KOfvxeeOo9j5IxjqRA5r/ikwVAwiAqtePPPjiAQL003ejguBh0aDW
jv220z1BhMjfrtk9+lKHLwLdGNIE2fV0hb6VqS365aybyaS9d8qePuziFumArRYB
JHqG4oL4mmtUnNBh6DrI
=nFLB
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Memory limits for children processes when running Tomcat as service?

Posted by Martin Gainty <mg...@hotmail.com>.
When you run your MS app standalone how much heap, stack does this process occupy?
When TC startsup how much heap,stack is left over for the standalone Microsoft app?

If youre not going to powerup your machine with 8GB RAM and at least tera of storage your only solution
is to configure your Microsoft Compound Documents be opened, read and written using POI
https://poi.apache.org/

Keep us apprised,
Martin
 
> From: j.tosovsky@email.cz
> To: users@tomcat.apache.org
> Subject: RE: Memory limits for children processes when running Tomcat as service?
> Date: Thu, 27 Jun 2013 21:24:03 +0200
> 
> On 2013-06-27 André Warnier wrote:
> > honyk wrote:
> > > On 2013-06-26 André Warnier wrote:
> > >> honyk wrote:
> > >>> Dear All,
> > >>>
> > >>> 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?
> > >>>
> > >> Hi.
> > >> 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.
> > >
> > > I read this article but because I do not need intraction and my code
> > doesn't
> > > run simultaneously and tomcat is launched using my credentials - I
> > still
> > > thought it could be possible.
> > >
> > > Now realizing that tomcat launched using my credentials do not
> > necesarily
> > > mean that Office use the same...
> > >
> > >> 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.
> > >
> > > I was an optimist when everything worked in the user mode...
> > >
> > >> 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).
> > >
> > > I'll give it a try. I originaly tested Apache POI, but required
> > > functionality is not implemented yet.
> > >
> > >> 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.
> > >
> > > I am quite lost in this ;-) But I'll investigate further.
> > >
> > > Thanks a lot for your exhaustive analysis! Finally it looks my way is
> > no way
> > > :-)
> > >
> > 
> > No problem. I went myself through the exact same issues as you
> > described, I did believe
> > that there must be a workaround, tried a number of things with great
> > loss of time, and
> > finally had to admit that the MS article was right and that there is no
> > good solution with
> > MS-Office when starting it from a Service.
> 
> I appreciate a lot your response and sharing your experience. Without it I
> would spend many additional hours of investigating, trial and error
> attempts, asking the same topic in different places, all this in heavy
> frustration... 
> 
> > About the Virtual Machine solution : usually, when you want something
> > to run as a Service,
> > it is because it has to run in the background, without a user being
> > logged-in, because of
> > security e.g.  Also because otherwise, when the logged-in user logs
> > off, any program that
> > he's running get killed.
> > With Virtual Machines (VM in short), you can create a Windows machine
> > that has no real
> > physical console, runs all the time, and where a user session can stay
> > logged-in all the
> > time.  So in that kind of machine, it is not usually a problem if a
> > user is logged-in and
> > remains logged-in, with a console window open, and Tomcat running in
> > it.
> > And in that console window, your Tomcat could be running via
> > startup.bat, and execute your
> > MS-Office commands without problems, as it is not a Service.
> 
> If I understand it correctly, this would need a special care when the VM is
> restarted - the user should log-in again. In meantime this system is out of
> work. It is a rare case though.
> 
> Jan
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

RE: Memory limits for children processes when running Tomcat as service?

Posted by honyk <j....@email.cz>.
On 2013-06-27 André Warnier wrote:
> honyk wrote:
> > On 2013-06-26 André Warnier wrote:
> >> honyk wrote:
> >>> Dear All,
> >>>
> >>> 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?
> >>>
> >> Hi.
> >> 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.
> >
> > I read this article but because I do not need intraction and my code
> doesn't
> > run simultaneously and tomcat is launched using my credentials - I
> still
> > thought it could be possible.
> >
> > Now realizing that tomcat launched using my credentials do not
> necesarily
> > mean that Office use the same...
> >
> >> 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.
> >
> > I was an optimist when everything worked in the user mode...
> >
> >> 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).
> >
> > I'll give it a try. I originaly tested Apache POI, but required
> > functionality is not implemented yet.
> >
> >> 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.
> >
> > I am quite lost in this ;-) But I'll investigate further.
> >
> > Thanks a lot for your exhaustive analysis! Finally it looks my way is
> no way
> > :-)
> >
> 
> No problem. I went myself through the exact same issues as you
> described, I did believe
> that there must be a workaround, tried a number of things with great
> loss of time, and
> finally had to admit that the MS article was right and that there is no
> good solution with
> MS-Office when starting it from a Service.

I appreciate a lot your response and sharing your experience. Without it I
would spend many additional hours of investigating, trial and error
attempts, asking the same topic in different places, all this in heavy
frustration... 

> About the Virtual Machine solution : usually, when you want something
> to run as a Service,
> it is because it has to run in the background, without a user being
> logged-in, because of
> security e.g.  Also because otherwise, when the logged-in user logs
> off, any program that
> he's running get killed.
> With Virtual Machines (VM in short), you can create a Windows machine
> that has no real
> physical console, runs all the time, and where a user session can stay
> logged-in all the
> time.  So in that kind of machine, it is not usually a problem if a
> user is logged-in and
> remains logged-in, with a console window open, and Tomcat running in
> it.
> And in that console window, your Tomcat could be running via
> startup.bat, and execute your
> MS-Office commands without problems, as it is not a Service.

If I understand it correctly, this would need a special care when the VM is
restarted - the user should log-in again. In meantime this system is out of
work. It is a rare case though.

Jan



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory limits for children processes when running Tomcat as service?

Posted by André Warnier <aw...@ice-sa.com>.
honyk wrote:
> On 2013-06-26 André Warnier wrote:
>> honyk wrote:
>>> Dear All,
>>>
>>> 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?
>>>
>> Hi.
>> 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.
> 
> I read this article but because I do not need intraction and my code doesn't
> run simultaneously and tomcat is launched using my credentials - I still
> thought it could be possible.
> 
> Now realizing that tomcat launched using my credentials do not necesarily
> mean that Office use the same...
> 
>> 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.
> 
> I was an optimist when everything worked in the user mode...
> 
>> 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).
> 
> I'll give it a try. I originaly tested Apache POI, but required
> functionality is not implemented yet.
> 
>> 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.
> 
> I am quite lost in this ;-) But I'll investigate further.
> 
> Thanks a lot for your exhaustive analysis! Finally it looks my way is no way
> :-)
> 

No problem. I went myself through the exact same issues as you described, I did believe 
that there must be a workaround, tried a number of things with great loss of time, and 
finally had to admit that the MS article was right and that there is no good solution with 
MS-Office when starting it from a Service.

About the Virtual Machine solution : usually, when you want something to run as a Service, 
it is because it has to run in the background, without a user being logged-in, because of 
security e.g.  Also because otherwise, when the logged-in user logs off, any program that 
he's running get killed.
With Virtual Machines (VM in short), you can create a Windows machine that has no real 
physical console, runs all the time, and where a user session can stay logged-in all the 
time.  So in that kind of machine, it is not usually a problem if a user is logged-in and 
remains logged-in, with a console window open, and Tomcat running in it.
And in that console window, your Tomcat could be running via startup.bat, and execute your 
MS-Office commands without problems, as it is not a Service.

With respect to licensing, as long as that machine runs a licensed version of MS-Office, 
and all your Tomcat client workstations themselves are allowed to use MS-Office, you 
shoukd be in the clear.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Memory limits for children processes when running Tomcat as service?

Posted by honyk <j....@email.cz>.
On 2013-06-26 André Warnier wrote:
> honyk wrote:
> > Dear All,
> >
> > 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?
> >
> 
> Hi.
> 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.

I read this article but because I do not need intraction and my code doesn't
run simultaneously and tomcat is launched using my credentials - I still
thought it could be possible.

Now realizing that tomcat launched using my credentials do not necesarily
mean that Office use the same...

> 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.

I was an optimist when everything worked in the user mode...

> 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).

I'll give it a try. I originaly tested Apache POI, but required
functionality is not implemented yet.

> 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.

I am quite lost in this ;-) But I'll investigate further.

Thanks a lot for your exhaustive analysis! Finally it looks my way is no way
:-)

Regards, Jan

PS: And sorry for blaming the Tomcat. 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory limits for children processes when running Tomcat as service?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 6/26/13 3:52 PM, André Warnier wrote:
> 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.

Or Apache POI - http://poi.apache.org/

...but it looks like you have already commented on the PowerPoint
forum about that.

I'm interested in what kind of OutOfMemoryError OP is getting: there
is more than one kind. It may be that OP is out of file handles or
something like that, and so changing the heap size isn't useful.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRy0xpAAoJEBzwKT+lPKRYOsUP/j+6VgMqgPGcMAHE4vKhrRvh
UUV2gZqgA7PScwPXKqVN+UckLnnpNpudYrIwk9yqDsCqALh6mYOHMfOm5OHrlP9c
GVwKeB1UuHCJg/zdCTbRlyojF7GxI7UWEQjbSq7ygFFG0cgiusQzS340Gtw7nsvI
tHG3W4xOErCdsdSmYLUijADEw+XGt7kA1m7XQpJJ0ryT3dWxWlk+5fnvm5Gu7GvI
lcWY+IV/V9tUimvKzhHAma0Bn/NjkOYtiKvG8fRq7cZWqmWmYMoYS7IQbYB2SKPB
3ujFa5ELdRJdtqNps085r3WsuBLSpYHwwS7XMGNsABLW6cS2R75QXcMKmTwB6/S0
WAiCVv8h2JI9zWL/CgpnXGZLmNeT6iICdCJjInYM4vXpQi+HU+JO3vv5XxqbidLr
kSpB9p0DO7Hb9wstnHvr847r8dWsy3duUNaLeLX+Ts46LC5jkISPLr9a2q0jq86x
0cxqubXq9jIpI1qIuElxC5s9idMEFpROVAxuwQ1XVNKwjmthmNB5SqbsTGfGw2UN
hBRDgYWGjqeDLYdLUvjQOZukd5DuZ6oVSrlh/66X/vbnhS38bG4z0qFWxh2kt8Nj
ReulZMBMWDc4casQWv+3GJXqMQ8IhaesVzGA6nc0KI61wn7tZSOKAdPpEksl0vAs
GLqCkdpnCKM5AF7Xtkhq
=ZBtl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory limits for children processes when running Tomcat as service?

Posted by André Warnier <aw...@ice-sa.com>.
honyk wrote:
> Dear All,
> 
> 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?
> 

Hi.
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.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Memory limits for children processes when running Tomcat as service?

Posted by honyk <j....@email.cz>.
On 2013-06-26 André Warnier wrote:
> honyk wrote:
> > Dear All,
> >
> > 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).
> 
> Note that the Xmx setting is probably irrelevant here. 

I suppose so, but I rather mentioned this.

> But the PPT process which you start will not use that memory area, it
> will use its own totally separate memory allocation.

Ok, thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory limits for children processes when running Tomcat as service?

Posted by André Warnier <aw...@ice-sa.com>.
honyk wrote:
> Dear All,
> 
> 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).

Note that the Xmx setting is probably irrelevant here. It determines how much memory the 
JVM (which runs Tomcat) will allocate for its Heap (which it uses to store Java object 
instances and data).
But the PPT process which you start will not use that memory area, it will use its own 
totally separate memory allocation.

> 
> 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?
> 
> Thanks, Jan
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org