WrapperManager.exec() is using fork() on Red Hat Enterprise Linux with WrapperProcessConfig.POSIX_SPAWN set

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

WrapperManager.exec() is using fork() on Red Hat Enterprise Linux with WrapperProcessConfig.POSIX_SPAWN set

Isenberg, Holger
Our Java based server application is bundled with Tanuki Wrapper since years and used on different Linux distributions at customer locations. Recently we observed Out Of Memory issues when launching external processes, a problem which was already solved years ago with WrapperManager.exec(). However, with Red Hat 6.5 and newer, fork() is used. I haven't analyzed it in detail yet, but assume Red Hat has removed posix_spawn() or just forwards it to fork().

As Java 8 is now offering posix_spawn(), too, I'll try that as workaround:
JDK-5049299 : (process) Use posix_spawn, not fork, on S10 to avoid swap exhaustion
Resolved Date: 2013-08-13
Fixed Versions: 8 (b105)

For launching the external process, Java 8 is using a similar method as Tanuki as it first starts an external process (jdk/jre/lib/jspawnhelper). Maybe falling back to this might be an option for Tanuki, too?

This sample apparently uses fork() on Red Hat 6.5 and newer:

String[] cmd = {"/bin/ls", "/tmp"};
WrapperProcessConfig wpc = new WrapperProcessConfig().setDetached(false).setStartType(WrapperProcessConfig.POSIX_SPAWN);
WrapperProcess p = org.tanukisoftware.wrapper.WrapperManager.exec(cmd, wpc);
int result = p.waitFor();

Holger Isenberg
Professional Services
e-Spirit AG

T: +49 231 477 77 331
M: +49 178 280 81 64
Fax: +49 231 477 77 499
[hidden email]

News für Content-Strategen: Jetzt abonnieren! http://www.e-spirit.com/newsletter
Digitales Marketing mit FirstSpirit http://www.e-spirit.com/digitalmarketing

Sitz des Unternehmens: Stockholmer Allee 24 | 44269 Dortmund
Vorstand: Jörn Bodemann (Vors.) | Udo Sträßer | Christoph Junge
Vorsitzender des Aufsichtsrats: Michael Kenfenheuer
Amtsgericht Dortmund (HRB 20399)

Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
Wrapper-user mailing list
[hidden email]