gpt4 book ai didi

java - Tomcat 无错误地崩溃

转载 作者:行者123 更新时间:2023-11-30 11:21:12 29 4
gpt4 key购买 nike

我开发了一个非常简单的 web 应用程序,目标是将它部署在我运行 archlinux 的树莓派上。一旦我从 tomcat 运行启动脚本,服务器日志就会以

结尾
"INFO: Server startup in 322789 ms" 

这已经很长了,但我认为这可能是由于覆盆子提供的低性能所致。无论如何,在启动阶段和服务器启动命令之后

"sudo lsof -n -P -i :8080" 

成功运行,即它向我显示一个正在运行的进程正在监听端口 8080。但是在服务器上发出一个简单的 wget 之后,相同的命令不再显示任何进程,表明 tomcat 崩溃了。此外,tomcat 的任何日志中都没有错误。实际上“localhost_access_log.xxxxx”的内容是:

127.0.0.1 - - [11/Mar/2014:17:02:06 -0600] "GET /volleyball-tool-backend/index.html HTTP/1.1" 200 1068
127.0.0.1 - - [11/Mar/2014:17:02:06 -0600] "GET /volleyball-tool-backend/ HTTP/1.1" 200 1068
127.0.0.1 - - [11/Mar/2014:18:26:34 -0600] "GET /volleyball-tool-backend/ HTTP/1.1" 200 1068

表示请求已成功处理。

编辑:

我仔细检查了一下,确实服务器确实成功地处理了至少一个初始请求。然后它崩溃了。

catalina.out日志的输出(一个启动周期):

Mar 11, 2014 7:36:43 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 11, 2014 7:36:43 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
Mar 11, 2014 7:36:44 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /home/ben/servers/volleyball-tool/apache-tomcat-7.0.52/webapps/volleyball-tool-backend.war
Mar 11, 2014 7:39:08 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [355] milliseconds.
Mar 11, 2014 7:39:22 PM org.glassfish.jersey.server.ApplicationHandler initialize
INFO: Initiating Jersey application, version Jersey: 2.6 2014-02-18 21:52:53...
Mar 11, 2014 7:39:36 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/ben/servers/volleyball-tool/apache-tomcat-7.0.52/webapps/manager
Mar 11, 2014 7:39:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/ben/servers/volleyball-tool/apache-tomcat-7.0.52/webapps/host-manager
Mar 11, 2014 7:40:19 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/ben/servers/volleyball-tool/apache-tomcat-7.0.52/webapps/examples
Mar 11, 2014 7:41:11 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/ben/servers/volleyball-tool/apache-tomcat-7.0.52/webapps/ROOT
Mar 11, 2014 7:41:33 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /home/ben/servers/volleyball-tool/apache-tomcat-7.0.52/webapps/docs
Mar 11, 2014 7:41:53 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 11, 2014 7:41:53 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mar 11, 2014 7:41:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 311351 ms

顺便说一句:为了部署我的 war 文件,我只是在启动它之前将其放入 tomcat 的 webapps 文件夹中。

编辑:

“localhost.xxxxx”日志内容:

Mar 11, 2014 5:01:52 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 11, 2014 5:01:52 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 11, 2014 5:01:52 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@1f718f2')
Mar 11, 2014 6:25:43 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 11, 2014 6:25:43 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 11, 2014 6:25:43 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@19df57a')
Mar 11, 2014 6:38:00 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 11, 2014 6:38:00 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 11, 2014 6:38:00 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@1dfdee0')
Mar 11, 2014 6:55:58 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 11, 2014 6:55:58 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 11, 2014 6:55:59 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@162108e')
Mar 11, 2014 7:41:11 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 11, 2014 7:41:11 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 11, 2014 7:41:11 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@162108e')

编辑:

我检查了dmesg:

[12259.897659] CPU: 0 PID: 12282 Comm: java Not tainted 3.10.33-1-ARCH #1
[12259.897731] [<c0013428>] (unwind_backtrace+0x0/0xec) from [<c00112d0>] (show_stack+0x10/0x14)
[12259.897776] [<c00112d0>] (show_stack+0x10/0x14) from [<c05a1ad0>] (dump_header.isra.15+0x84/0x1c4)
[12259.897815] [<c05a1ad0>] (dump_header.isra.15+0x84/0x1c4) from [<c00b6558>] (oom_kill_process+0x278/0x3f8)
[12259.897845] [<c00b6558>] (oom_kill_process+0x278/0x3f8) from [<c00b6b6c>] (out_of_memory+0x280/0x2cc)
[12259.897877] [<c00b6b6c>] (out_of_memory+0x280/0x2cc) from [<c00babbc>] (__alloc_pages_nodemask+0x880/0x968)
[12259.897906] [<c00babbc>] (__alloc_pages_nodemask+0x880/0x968) from [<c00d2e90>] (__pte_alloc+0x20/0x180)
[12259.897936] [<c00d2e90>] (__pte_alloc+0x20/0x180) from [<c00d6000>] (handle_mm_fault+0xd8/0xf0)
[12259.897970] [<c00d6000>] (handle_mm_fault+0xd8/0xf0) from [<c05aab14>] (do_page_fault+0x26c/0x3e8)
[12259.897999] [<c05aab14>] (do_page_fault+0x26c/0x3e8) from [<c0008354>] (do_DataAbort+0x34/0x98)
[12259.898026] [<c0008354>] (do_DataAbort+0x34/0x98) from [<c05a94fc>] (__dabt_usr+0x3c/0x40)
[12259.898041] Exception stack(0xca323fb0 to 0xca323ff8)
[12259.898061] 3fa0: a81fffe8 a24cd068 00000090 00000000
[12259.898082] 3fc0: 00000000 00000000 00000000 00000000 00000000 a28aaf0c b05bb570 a28aaf00
[12259.898101] 3fe0: 00000000 a18a95e4 00000000 b6de9c00 20000010 ffffffff
[12259.898112] Mem-info:
[12259.898124] Normal per-cpu:
[12259.898136] CPU 0: hi: 42, btch: 7 usd: 26
[12259.898164] active_anon:29834 inactive_anon:43 isolated_anon:0
active_file:176 inactive_file:2050 isolated_file:0
unevictable:0 dirty:0 writeback:0 unstable:0
free:82664 slab_reclaimable:653 slab_unreclaimable:972
mapped:555 shmem:95 pagetables:243 bounce:0
free_cma:74731
[12259.898231] Normal free:330656kB min:32768kB low:40960kB high:49152kB active_anon:119336kB inactive_anon:172kB active_file:704kB inactive_file:8200kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:487424kB managed:170128kB mlocked:0kB dirty:0kB writeback:0kB mapped:2220kB shmem:380kB slab_reclaimable:2612kB slab_unreclaimable:3888kB kernel_stack:824kB pagetables:972kB unstable:0kB bounce:0kB free_cma:298924kB writeback_tmp:0kB pages_scanned:331 all_unreclaimable? yes
[12259.898248] lowmem_reserve[]: 0 0
[12259.898266] Normal: 74*4kB (UEMC) 53*8kB (EC) 43*16kB (UEM) 21*32kB (UEC) 26*64kB (UEM) 16*128kB (EMC) 13*256kB (UEMC) 10*512kB (UEMC) 3*1024kB (UEC) 3*2048kB (UMC) 75*4096kB (MRC) = 330656kB
[12259.898353] 2321 total pagecache pages
[12259.898368] 0 pages in swap cache
[12259.898379] Swap cache stats: add 0, delete 0, find 0/0
[12259.898388] Free swap = 0kB
[12259.898396] Total swap = 0kB
[12259.929094] 121856 pages of RAM
[12259.929126] 82868 free pages
[12259.929136] 3488 reserved pages
[12259.929145] 1275 slab pages
[12259.929154] 263343 pages shared
[12259.929163] 0 pages swap cached
[12259.929174] [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name
[12259.929219] [ 69] 0 69 4980 140 12 0 0 systemd-journal
[12259.929240] [ 83] 0 83 2372 80 6 0 -1000 systemd-udevd
[12259.929260] [ 106] 0 106 418 12 5 0 0 rngd
[12259.929279] [ 107] 0 107 1568 96 6 0 -1000 sshd
[12259.929298] [ 108] 0 108 700 127 4 0 0 crond
[12259.929320] [ 110] 0 110 520 22 5 0 0 avahi-dnsconfd
[12259.929340] [ 111] 0 111 435 24 4 0 0 ifplugd
[12259.929359] [ 114] 0 114 639 45 5 0 0 systemd-logind
[12259.929378] [ 115] 84 115 794 53 5 0 0 avahi-daemon
[12259.929397] [ 116] 81 116 929 99 5 0 -900 dbus-daemon
[12259.929416] [ 117] 0 117 1202 767 6 0 0 haveged
[12259.929436] [ 118] 84 118 758 35 5 0 0 avahi-daemon
[12259.929455] [ 123] 0 123 445 20 5 0 0 agetty
[12259.929473] [ 124] 0 124 445 19 5 0 0 agetty
[12259.929523] [ 234] 0 234 512 37 5 0 0 dhcpcd
[12259.929545] [ 365] 89 365 127778 12469 57 0 0 mysqld
[12259.929568] [11939] 0 11939 2572 167 8 0 0 sshd
[12259.929587] [11943] 0 11943 851 66 5 0 0 systemd
[12259.929607] [11944] 0 11944 1770 273 6 0 0 (sd-pam)
[12259.929626] [11945] 0 11945 811 65 5 0 0 bash
[12259.929644] [11946] 0 11946 1094 66 6 0 0 su
[12259.929663] [11947] 1000 11947 840 78 5 0 0 bash
[12259.929701] [12280] 0 12280 99612 15513 63 0 0 java
[12259.929717] Out of memory: Kill process 12280 (java) score 127 or sacrifice child
[12259.937632] Killed process 12280 (java) total-vm:398448kB, anon-rss:60236kB, file-rss:1816kB

显然它说内存不足。请注意,在没有我的 webapp 的情况下运行默认的 tomcat 设置时,我也会遇到此错误。我该怎么办?

我还完全重置了树莓派并从头开始安装了所有东西:设置如下所示:

-RaspberryPi
-ArchlinuxARM
-OracleJVM/OpenJDK (both don't work)
-ApacheTomcat from: https://tomcat.apache.org/download-60.cgi
-MariaDB
-Maria JDBC Connector from https://downloads.mariadb.org/client-java/

我在这里进一步捕获了 atop 的输出:

http://oi60.tinypic.com/dre936.jpg

请注意有关交换空间的红色行。我不知道从中可以推断出什么。正如我所说,我使用 Raspberry 站点的“Noobs”工具进行了全新安装,因此我假设他们或操作系统会负责交换。

启动顺序:sudo ./[TOMCATDIR]/startup.sh

问候

最佳答案

创建一个交换文件就可以了。因此,这确实是内存泄漏。

关于java - Tomcat 无错误地崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22340034/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com