java 在 Google App Engine 上部署 Web 应用程序时调用了 oom-killer

java invoked oom-killer while deploying a webapp on Google App Engine

我想将网络应用程序部署到 App Engine。此 Web 应用程序包含多个启动一些 Google 数据流作业的 servlet。

我没问题 运行在本地安装我的 webapp (mvn jetty:run) 并启动调用我的 servlet 的数据流作业。但是我正在努力在 App Engine 中部署 webapp。

错误信息是:

A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.506921] java invoked oom-killer: gfp_mask=0xd0, order=0, oom_score_adj=0 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.514328] java cpuset=b888170c5457fc14d6375c3a890ae140db7e7c0103fc3f400fed0177bce46b2c mems_allowed=0 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.524285] CPU: 0 PID: 4159 Comm: java Tainted: G         C    3.16.0-4-amd64 #1 Debian 3.16.39-1 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.533382] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.542888]  0000000000000000 ffffffff81514c11 ffff88003cd263d0 ffff88002ee41400 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.550958]  ffffffff815127e9 ffff88003cd268e8 0000000100000000 ffff88003d5d4800 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.558957]  ffff88003cd263d0 ffff88003fc12f40 ffff88003c76b080 ffff88003d5d4800 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.567115] Call Trace: 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.569688]  [<ffffffff81514c11>] ? dump_stack+0x5d/0x78 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.575112]  [<ffffffff815127e9>] ? dump_header+0x76/0x1e8 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.580812]  [<ffffffff8114243d>] ? find_lock_task_mm+0x3d/0x90 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.586929]  [<ffffffff8114287d>] ? oom_kill_process+0x21d/0x370 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.593048]  [<ffffffff8114243d>] ? find_lock_task_mm+0x3d/0x90 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.599254]  [<ffffffff811a292a>] ? mem_cgroup_oom_synchronize+0x52a/0x590 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.606417]  [<ffffffff811a1eb0>] ? mem_cgroup_try_charge_mm+0xa0/0xa0 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.613333]  [<ffffffff81143030>] ? pagefault_out_of_memory+0x10/0x80 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.619886]  [<ffffffff81058515>] ? __do_page_fault+0x3c5/0x4f0 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.626010]  [<ffffffff81173bbf>] ? mprotect_fixup+0x14f/0x270 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.631985]  [<ffffffff8151cde8>] ? page_fault+0x28/0x30 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.637757] Task in /b888170c5457fc14d6375c3a890ae140db7e7c0103fc3f400fed0177bce46b2c killed as a result of limit of /b888170c5457fc14d6375c3a890ae140db7e7c0103fc3f400fed0177bce46b2c 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.654851] memory: usage 629760kB, limit 629760kB, failcnt 7625 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.660978] memory+swap: usage 0kB, limit 18014398509481983kB, failcnt 0 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.667813] kmem: usage 0kB, limit 18014398509481983kB, failcnt 0 
A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.674120] Memory cgroup stats for /b888170c5457fc14d6375c3a890ae140db7e7c0103fc3f400fed0177bce46b2c: cache:24KB rss:629736KB rss_huge:0KB mapped_file:0KB writeback:0KB inactive_anon:0KB active_anon:629760KB inactive_file:0KB active_file:0KB unevictable:0KB
A  Feb 27 19:16:07 aef-default-version20-xpjd kernel: [   50.561039] [ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name 
A  Feb 27 19:16:07 aef-default-version20-xpjd kernel: [   50.569102] [ 3912]   999  3912   746739   158540     567        0             0 java 
A  Feb 27 19:16:07 aef-default-version20-xpjd kernel: [   50.577122] Memory cgroup out of memory: Kill process 3912 (java) score 1010 or sacrifice child 
A  Feb 27 19:16:07 aef-default-version20-xpjd kernel: [   50.585961] Killed process 3912 (java) total-vm:2986956kB, anon-rss:627524kB, file-rss:6636kB 

问题可能出在这个内存限制中(?):

A  Feb 28 09:26:05 aef-default-version22-rh34 kernel: [   47.654851] memory: usage 629760kB, limit 629760kB, failcnt 7625  

你知道是哪个内存吗?我的 war 文件是否包含我 运行 填充超过 629760kB 内存的数据流管道所需的所有依赖项?您有什么想法可以去哪里看吗?

是的,您的应用似乎需要超过默认的 0.6 GB 或内存,您需要在 Resource settings:

中配置更多内存

memory_gb

RAM in GB. The requested memory for your application. Each CPU core requires between 0.9 and 6.5 GB of total memory, which includes ~0.4 GB for the overhead of some processes (subject to change). To calculate the requested memory: memory_gb = NUMBER_CPU_CORES * [0.9 - 6.5] - 0.4. For the example above where you have specified 2 cores, you can request between 1.4 and 12.6 GB. The total amount of memory available to the application is set by the runtime environment as the environment variable GAE_MEMORY_MB.