Tomcat 异常关闭排查

N次请求

tomcat conf/server.xml

https://blog.csdn.net/qq_30121245/article/details/52861935

pattern分析 

%a   这是记录访问者的IP,在日志里是127.0.0.1
%A   这是记录本地服务器的IP,在日志里是192.168.254.108
%b   发送信息的字节数,不包括http头,如果字节数为0的话,显示为-
%B   发送信息的字节数,不包括http头。
%h   服务器的名称。如果resolveHosts为false的话,这里就是IP地址了,例如我的日志里是10.217.14.16
%H   访问者的协议,这里是HTTP/1.0
%l   官方解释:Remote logical username from identd (可能这样翻译:记录浏览者进行身份验证时提供的名字)(always returns '-')
%m   访问的方式,是GET还是POST
%p   本地接收访问的端口 
%q   比如你访问的是aaa.jsp?bbb=ccc,那么这里就显示?bbb=ccc,就是querystring的意思
%r   First line of the request (method and request URI) 请求的方法和URL
%s   http的响应状态码 
%S   用户的session ID,这个session ID大家可以另外查一下详细的解释,反正每次都会生成不同的session ID
%t   请求时间
%u   得到了验证的访问者,否则就是"-"
%U   访问的URL地址,我这里是/rightmainima/leftbott4.swf
%v   服务器名称,可能就是你url里面写的那个吧,我这里是localhost
%D   Time taken to process the request,in millis,请求消耗的时间,以毫秒记
%T   Time taken to process the request,in seconds,请求消耗的时间,以秒记

内存溢出

 /var/log/message查看

Jul  3 21:35:01 VM_0_15_centos systemd: Starting Session 158959 of user root.
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff816a3d91>] dump_stack+0x19/0x1b
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff81185e3d>] ? oom_unkillable_task+0xcd/0x120
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff8118cd85>] __alloc_pages_nodemask+0x405/0x420
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff811d1108>] alloc_pages_current+0x98/0x110
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff81182917>] __page_cache_alloc+0x97/0xb0
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff81184eb0>] filemap_fault+0x170/0x410
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffffc01b8156>] ext4_filemap_fault+0x36/0x50 [ext4]
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff811ad162>] __do_fault+0x52/0xe0
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff811ad60b>] do_read_fault.isra.44+0x4b/0x130
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff811b1f11>] handle_mm_fault+0x691/0xfa0
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff816a84c7>] ? do_nanosleep+0xa7/0xf0
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff816affb4>] __do_page_fault+0x154/0x450
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff816b02e5>] do_page_fault+0x35/0x90
Jul  3 21:35:30 VM_0_15_centos kernel: [<ffffffff816ac508>] page_fault+0x28/0x30
Jul  3 21:35:30 VM_0_15_centos kernel: Mem-Info:
Jul  3 21:35:30 VM_0_15_centos kernel: lowmem_reserve[]: 0 975 975 975
Jul  3 21:35:30 VM_0_15_centos kernel: lowmem_reserve[]: 0 0 0 0
Jul  3 21:35:30 VM_0_15_centos kernel: Node 0 DMA: 32*4kB (UE) 43*8kB (UE) 30*16kB (UEM) 20*32kB (UE) 9*64kB (UEM) 3*128kB (UEM) 4*256kB (UEM) 2*512kB (U) 0*1024kB 0*2048kB 0*4096kB = 4600kB
Jul  3 21:35:30 VM_0_15_centos kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Jul  3 21:35:30 VM_0_15_centos kernel: 4854 total pagecache pages
Jul  3 21:35:30 VM_0_15_centos kernel: 0 pages in swap cache
Jul  3 21:35:30 VM_0_15_centos kernel: Swap cache stats: add 0, delete 0, find 0/0
Jul  3 21:35:30 VM_0_15_centos kernel: Free swap  = 0kB
Jul  3 21:35:30 VM_0_15_centos kernel: Total swap = 0kB
Jul  3 21:35:30 VM_0_15_centos kernel: 262044 pages RAM
Jul  3 21:35:30 VM_0_15_centos kernel: 0 pages HighMem/MovableOnly
Jul  3 21:35:30 VM_0_15_centos kernel: 7972 pages reserved
Jul  3 21:35:30 VM_0_15_centos kernel: [ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name
Jul  3 21:35:30 VM_0_15_centos kernel: [  335]     0   335    19545      179      41        0             0 systemd-journal
Jul  3 21:35:30 VM_0_15_centos kernel: [  356]     0   356    29712       84      27        0             0 lvmetad
Jul  3 21:35:30 VM_0_15_centos kernel: [  362]     0   362    10955      132      23        0         -1000 systemd-udevd
Jul  3 21:35:30 VM_0_15_centos kernel: [  441]     0   441    13863      113      27        0         -1000 auditd
Jul  3 21:35:30 VM_0_15_centos kernel: [  473]     0   473     6084      151      16        0             0 systemd-logind
Jul  3 21:35:30 VM_0_15_centos kernel: [  474]    81   474     6659      125      18        0          -900 dbus-daemon
Jul  3 21:35:30 VM_0_15_centos kernel: [  475]     0   475     1085       35       7        0             0 acpid
Jul  3 21:35:30 VM_0_15_centos kernel: [  476]   998   476     2133       36      10        0             0 lsmd
Jul  3 21:35:30 VM_0_15_centos kernel: [  478]   999   478   134053     2157      57        0             0 polkitd
Jul  3 21:35:30 VM_0_15_centos kernel: [  479]     0   479   178540      433     181        0             0 rsyslogd
Jul  3 21:35:30 VM_0_15_centos kernel: [  764]     0   764     6464       52      18        0             0 atd
Jul  3 21:35:30 VM_0_15_centos kernel: [  765]     0   765    31566      201      19        0             0 crond
Jul  3 21:35:30 VM_0_15_centos kernel: [  818]     0   818    28343     3124      53        0             0 dhclient
Jul  3 21:35:30 VM_0_15_centos kernel: [  885]     0   885   141129     2730      96        0             0 tuned
Jul  3 21:35:30 VM_0_15_centos kernel: [  896]     0   896    27511       32       9        0             0 agetty
Jul  3 21:35:30 VM_0_15_centos kernel: [  897]     0   897    27511       32      12        0             0 agetty
Jul  3 21:35:30 VM_0_15_centos kernel: [  940]     0   940    26499      245      53        0         -1000 sshd
Jul  3 21:35:30 VM_0_15_centos kernel: [  990]    38   990     7994      184      22        0             0 ntpd
Jul  3 21:35:30 VM_0_15_centos kernel: [ 1302]     0  1302    25171      108      19        0             0 YDLive
Jul  3 21:35:30 VM_0_15_centos kernel: [ 1369]     0  1369   376850     1656     145        0             0 YDService
Jul  3 21:35:30 VM_0_15_centos kernel: [27523]    32 27523    16255      170      35        0             0 rpcbind
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6775]     0  6775    30927      730      62        0             0 nginx
Jul  3 21:35:30 VM_0_15_centos kernel: [28373]   996 28373    31564      959      63        0             0 nginx
Jul  3 21:35:30 VM_0_15_centos kernel: [ 1970]     0  1970   579444    48524     153        0             0 java
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6071]     0  6071    39351     1670      31        0             0 barad_agent
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6078]     0  6078    45425     2002      43        0             0 barad_agent
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6079]     0  6079   152605     2716      48        0             0 barad_agent
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6397]     0  6397    24324      115      19        0             0 sgagent
Jul  3 21:35:30 VM_0_15_centos kernel: [  914]     0   914   672195   131050     500        0             0 java
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6625]     0  6625    36396      379      72        0             0 sshd
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6626]    74  6626    26499      274      53        0             0 sshd
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6639]     0  6639    95428     2672      75        0             0 python
Jul  3 21:35:30 VM_0_15_centos kernel: [ 6645]     0  6645    25943      410      50        0             0 sshd
Jul  3 21:35:30 VM_0_15_centos kernel: Out of memory: Kill process 914 (java) score 502 or sacrifice child
Jul  3 21:35:30 VM_0_15_centos kernel: Killed process 914 (java) total-vm:2688780kB, anon-rss:524200kB, file-rss:0kB, shmem-rss:0kB
Jul  3 21:35:31 VM_0_15_centos systemd-logind: Removed session 151212.
Jul  3 21:36:01 VM_0_15_centos systemd: Started Session 158960 of user root.
原文地址:https://www.cnblogs.com/eason-d/p/9262716.html