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

[bug]: 使用docker-compose部署,campus-server起来一会儿后退出,日志显示:exited with code 137 #359

Open
3 tasks done
zhangshu9206 opened this issue Apr 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@zhangshu9206
Copy link

zhangshu9206 commented Apr 29, 2024

请确保您已阅读以上注意事项,并勾选下方的确认框。

  • 我已确认我已升级到最新版本(最新代码)测试过,问题依旧存在。
  • 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

campus框架版本

No response

本项目 campus-imaotai 版本

V1.0.13

运行环境

其它(请在下方说明)

运行架构

None

问题描述

使用docker-compose部署,campus-server起来一会儿后退出,日志显示:exited with code 137

运行系统:Debian
root@localhost:~# uname -a
Linux localhost.localdomain 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) x86_64 GNU/Linux

现象:前端登陆未显示验证码
image

期望的结果是什么?

Debian 系统上可以正常运行

简单的复现代码/链接(可选)

No response

日志记录(可选)

campus-server 运行日志:

root@localhost:~# docker logs campus-server

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot :: (v2.5.15)

2024-04-29 22:54:29 |INFO |StartupInfoLogger.java:55 |Starting CampusApplication using Java 1.8.0_312 on 818d34ba2dfd with PID 1 (/home/campus/campus.jar started by root in /home/campus)
2024-04-29 22:54:29 |DEBUG |StartupInfoLogger.java:56 |Running with Spring Boot v2.5.15, Spring v5.3.27
2024-04-29 22:54:29 |INFO |SpringApplication.java:686 |The following 1 profile is active: "prod"
2024-04-29 22:54:43 |INFO |DirectJDKLog.java:173 |Initializing ProtocolHandler ["http-nio-8160"]
2024-04-29 22:54:43 |INFO |DirectJDKLog.java:173 |Starting service [Tomcat]
2024-04-29 22:54:43 |INFO |DirectJDKLog.java:173 |Starting Servlet engine: [Apache Tomcat/9.0.75]
2024-04-29 22:54:43 |INFO |DirectJDKLog.java:173 |Initializing Spring embedded WebApplicationContext
2024-04-29 22:54:47 |DEBUG |GenericFilterBean.java:242 |Filter 'jwtAuthenticationTokenFilter' configured for use
2024-04-29 22:54:48 |INFO |HikariDataSource.java:80 |master - Starting...
2024-04-29 22:54:50 |INFO |HikariDataSource.java:82 |master - Start completed.
2024-04-29 22:54:50 |INFO |DynamicRoutingDataSource.java:160 |dynamic-datasource - add a datasource named [master] success
2024-04-29 22:54:50 |INFO |DynamicRoutingDataSource.java:243 |dynamic-datasource initial loaded [1] datasource,primary datasource named [master]
_ _ |_ _ |. ___ _ | _
| | |/|)(| | |\ |)|||\
/ |
3.5.4.1
2024-04-29 22:56:06 |WARN |HikariPool.java:788 |master - Thread starvation or clock leap detected (housekeeper delta=1m8s774ms587µs938ns).

通过journalctl查看oom日志如下:

root@localhost:~# journalctl -k | grep -i -e memory -e oom
Apr 29 10:57:51 localhost.localdomain kernel: redis-server invoked oom-killer: gfp_mask=0x6200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=0
Apr 29 10:57:51 localhost.localdomain kernel: oom_kill_process.cold.29+0xb/0x1cf
Apr 29 10:57:51 localhost.localdomain kernel: ? oom_badness+0x23/0x130
Apr 29 10:57:51 localhost.localdomain kernel: out_of_memory+0x1a5/0x440
Apr 29 10:57:51 localhost.localdomain kernel: Tasks state (memory values in pages):
Apr 29 10:57:51 localhost.localdomain kernel: [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name
Apr 29 10:57:51 localhost.localdomain kernel: Out of memory: Kill process 7908 (java) score 271 or sacrifice child
Apr 29 10:57:51 localhost.localdomain kernel: oom_reaper: reaped process 7908 (java), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

补充说明(可选)

系统更换成Centos后可以启动运行,但挂机一段时间后‘campus-server’容器也会退出,怀疑是Docker 容器中的 Java 应用程序占用内存大导致被docker kill掉,内存占用如下所示:
image
看来我这个VPS小牛拉不动大车啊。。

@zhangshu9206 zhangshu9206 added the bug Something isn't working label Apr 29, 2024
@oddfar
Copy link
Owner

oddfar commented May 25, 2024

emmm,可能就是内存大导致的

@gemail1024
Copy link

可以参考我这个教程,占用内存约263M,不起其他应用的话应该可以带的动。https://www.bilibili.com/read/cv35848276/

@lbbboy
Copy link

lbbboy commented Sep 9, 2024

docker-compose  down
docker rm campus-nginx campus-server campus-redis campus-mysql

最后
docker-compose -d up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants