Java fails to start or create thread unexpectedly when launched through xinetd

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL)
  • Java
  • xinetd

Issue

  • We launch multiple JVMs through xinetd. When multiple JVMs are running, additional JVMs fail to launch, crashing during start due to java.lang.OutOfMemoryError "Cannot create GC thread. Out of system resources"
  • Our JVm starts throwing java java.lang.OutOfMemoryError "unable to create new native thread" errors. We increase our process ulimit, but it seems to have no impact to allow more threads.

Resolution

Root Cause

  • ulimits are not applied as normal to a process launched through xinetd

Diagnostic Steps

  • Check the rlimit line provided in any generate hs_err crash files to see if it reflects the expected configured ulimit or not:

      rlimit: STACK 10240k, CORE 0k, NPROC 1024, NOFILE 8192, AS infinity
    
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.