1

We are using Red Hat Enterprise Linux Server 7.4 (Maipo) and tomcat 8.5.30 . While accessing website the process count is increasing for java process rapidly and it reaches up to the extend where the max user processes limit crossed and we are getting fork: Resource temporarily unavailable error enter image description here

another issue is increased process count is not decreasing with time and it is constantly increasing. Below is systemd service file for tomcat

# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking
LimitNOFILE=65535

Environment=JAVA_HOME=/usr/java/jdk1.8.0_161/jre
Environment=CATALINA_PID=/u01/tomcat-lb1/temp/tomcat.pid
Environment=CATALINA_HOME=/u01/tomcat
Environment=CATALINA_BASE=/u01/tomcat-lb1
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dconnector.ip=10.40.5.22 -Dconnector.port=901'

ExecStart=/u01/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=ipMonitor
Group=kcAlerts
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target
  • This isn't an answer to your question, but I would change ExecStop=/bin/kill -15 $MAINPID to ExecStop=/u01/tomcat/bin/shutdown.sh – Mark Stewart Jun 7 '18 at 14:46
2

Looks like the payload code of your Tomcat server might have a thread leak.

A thread leak is a type of resource leak: if references to thread objects are not properly released, old execution threads may not get garbage collected.

You (or your application developer) should also make sure that all exceptions are properly handled and any resources used in a temporary thread (connections, files, etc.) are properly released before the thread is closed, to avoid thread leaks.

Sending a SIGQUIT signal to the java process will cause it to generate a thread dump to standard output: a full listing of all its execution threads and what each thread is currently doing. Providing a thread dump to the application developer should help the developer identify which threads are not getting cleaned up properly, and hopefully fix the root cause.

java---1896*[{java}]

Here {curly braces} in pstree output indicate child threads, as opposed to a multitude of identically-named child processes.

| improve this answer | |
  • 1
    i m able to find out root problem .i have integrated elastic search and while querying from elastic search i was not closing the client connection after closing connection the problem get resolved – Abdul Qadir Jun 28 '18 at 9:57
  • That makes sense. Good catch! – telcoM Jun 28 '18 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.