개발/보안,네트워크,서버

Tomcat | shutdown.sh 안될때 | error='Cannot allocate memory' ...The stop command failed.

AM0530 2022. 3. 25. 10:09

1. 이슈 : shutdown.sh 명령 실행시 메모리 부족으로 shutdown 안됨 

 

2. 오류메세지 :

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000a0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/.../tomcat7/bin/hs_err_pid10033.log
The stop command failed. Attempting to signal the process to stop through OS signal.
Tomcat did not stop in time.
PID file was not removed.
To aid diagnostics a thread dump has been written to standard out.

3. 해결 방법 : 메모리 확보 후 ./shutdown.sh 명령 재실행 

 3-1. root 계정으로 변경 

 명령어 : sudo -s  

 

 3-2. 메모리 용량 확인 : 

  명령어 : free -m

 

 3-3. 메모리에서 buffer/cached 삭제 

  명령어 : sync && echo 3 > /proc/sys/vm/drop_caches

해당 작업 후 ./shtudown.sh 명령어를 다시 실행하면 정상 실행된다.