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

[server]:有充足内存的情况下报错OutOfMemoryError #486

Open
Ovler-Young opened this issue Jan 24, 2024 · 4 comments
Open

[server]:有充足内存的情况下报错OutOfMemoryError #486

Ovler-Young opened this issue Jan 24, 2024 · 4 comments

Comments

@Ovler-Young
Copy link

Describe the bug 描述你遇到的问题
有充足内存的情况下报错OutOfMemoryError ,类似于 #429 ,但明确并非真的发生了内存不足

To Reproduce 如何重现问题
Steps to reproduce the behavior: 把你遇到的问题的发生步骤替换掉下面的内容:

  1. 使用docker运行reader,并限制内存为2G
  2. 对内存占用进行监测
  3. 使用10并发进行书源检测
  4. 大量请求无返回,达到超时请求后失败;查看日志发现大量报错OutOfMemoryError,但此时仍有充足内存供使用。
    log如:Exception in thread "DefaultDispatcher-worker-xx" java.lang.OutOfMemoryError: Java heap space

Expected behavior 期待修复的效果
在用完或接近用完时再报错OutOfMemoryError,方案为增加自定义堆内存大小,如允许在JVM启动时指定参数且不会被脚本覆盖
-Xmx2048m,如在下面这行就会和手动设置的内存数冲突。

JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=160m"

Screenshots 如有必要,可以截图说明
容器内存情况
image
宿主机内存情况
image
日志
image

版本说明

  • OS: Ubuntu 22.04
  • Deploy Method: Docker
  • Program Version: v3.2.7-01010833
  • Browser: Google Chrome v120
@hectorqin
Copy link
Owner

reader/server/bin/startup.sh 这个启动脚本是服务端用的,不是docker用的,你看看是不是在 docker-compose 里面限制了内存上限

@Ovler-Young
Copy link
Author

设置了上限,是2G,还没有吃完

@iqiuzixuan
Copy link

我也这样的情况,系统内存还有 4G,docker 没有做限制。通过 journalctl 过滤日志,发现容器重启会打印 Feb 06 17:06:35 xapp kernel: __vm_enough_memory: pid: 25984, comm: java, not enough memory for the allocation 这样的日志,是不是默认下java的内存限制了?

@hectorqin
Copy link
Owner

我也这样的情况,系统内存还有 4G,docker 没有做限制。通过 journalctl 过滤日志,发现容器重启会打印 Feb 06 17:06:35 xapp kernel: __vm_enough_memory: pid: 25984, comm: java, not enough memory for the allocation 这样的日志,是不是默认下java的内存限制了?

你是怎么启动的?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants