Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tomcat and systemd 100% system usage #13

Closed
pleutres opened this issue May 6, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@pleutres
Copy link

commented May 6, 2019

Describe the bug
When started using systemd service, the java process hang with 100% system CPU.
When started with normal tomcat user, it started normally

To Reproduce
Steps to reproduce the behavior:

  1. Run this role:
  2. Deploy a war with annotations, wait.

Expected behavior
Normal startup with serviced

Error

Environment

  • VM : Cento OS 7
  • Tomcat 9.0.17

Additional context
Resolved with strace on java process, it was recursively reading : /proc/self/task/81569/cwd/proc/self/task/81569/cwd/proc/self/task/81569/cwd/proc/self/task/81569/cwd/proc/self/task/81569/cwd/proc/self/task/8156...

Java process was outside of his directory, even if launch with correct user.

Just add working_directory parameter to service.role:

service_list: - name: "{{ instance.name | default(tomcat_name) }}" description: "{{ instance.name | default(tomcat_name) }}" start_command: "{{ tomcat_directory }}/{{ instance.name | default(tomcat_directory) }}/bin/catalina.sh run" user_name: "{{ instance.user | default(tomcat_user) }}" group_name: "{{ instance.group | default(tomcat_group) }}" working_directory: "{{ tomcat_directory }}/{{ instance.name | default(tomcat_directory) }}/"

@robertdebock

This comment has been minimized.

Copy link
Owner

commented May 6, 2019

Thanks @pleutres, I'll look into the issue a little later!

@robertdebock

This comment has been minimized.

Copy link
Owner

commented May 7, 2019

Hi, I can't reproduce the issue, I've used:

This virtual machine:

  config.vm.define "centos7-1" do |centos7|
    centos7.vm.box = "centos/7"
    centos7.vm.synced_folder '.', '/vagrant', disabled: true
  end

And this playbook:

---
- name: Converge
  hosts: all
  gather_facts: no
  become: yes

  vars:
    tomcat_instances:
      - name: "tomcat-version9"
        version: 9

  roles:
    - robertdebock.bootstrap
    - robertdebock.java
    - robertdebock.tomcat

The machine is running, tomcat is started:

[vagrant@localhost ~]$ ps -ef | grep tomcat
tomcat    6059     1  0 19:16 ?        00:00:04 /usr/bin/java -Djava.util.logging.config.file=/opt/tomcat-version9/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -Dignore.endorsed.dirs= -classpath /opt/tomcat-version9/bin/bootstrap.jar:/opt/tomcat-version9/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat-version9 -Dcatalina.home=/opt/tomcat-version9 -Djava.io.tmpdir=/opt/tomcat-version9/temp org.apache.catalina.startup.Bootstrap start

And the processes look good:

top - 19:25:44 up 12 min,  1 user,  load average: 0.00, 0.07, 0.10
Tasks:  83 total,   2 running,  81 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :   498812 total,     6468 free,   135328 used,   357016 buff/cache
KiB Swap:  2097148 total,  2096372 free,      776 used.   315196 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND      
 6059 tomcat    20   0 2093080  73512  14644 S  0.7 14.7   0:04.90 java         
    1 root      20   0  127984   6444   3916 S  0.0  1.3   0:02.12 systemd      
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd     

Can you tell me how I can reproduce the issue?

@robertdebock

This comment has been minimized.

Copy link
Owner

commented May 14, 2019

I'm going to close the issue, if you have information how I can reproduce this (a playbook for example), please reopen and I will re-check.

@pleutres

This comment has been minimized.

Copy link
Author

commented May 15, 2019

OK, the CentOS 7 VM has not be mount by me so I can not give more details for instance.
If I can reproduce it in a VM mount by me I'll keep you update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.