【问题标题】:Memory leak with spring-boot actuator InMemoryAuditEventRepository弹簧启动执行器 InMemoryAuditEventRepository 的内存泄漏
【发布时间】:2018-10-12 09:05:09
【问题描述】:

我的 spring-boot 应用程序面临内存泄漏,在使用 Eclipse MAT 进行 heapdump 分析后,它指出了 spring-boot 执行器中的潜在内存:精确地使用 InMemoryAuditEventRepository(审计事件)。

One instance of "org.springframework.boot.actuate.audit.InMemoryAuditEventRepository" loaded by "sun.misc.Launcher$AppClassLoader @ 0xe7020a30" occupies 210 676 784 (57,25%) bytes. The memory is accumulated in one instance of "org.springframework.boot.actuate.audit.AuditEvent[]" loaded by "sun.misc.Launcher$AppClassLoader @ 0xe7020a30".

Keywords
org.springframework.boot.actuate.audit.InMemoryAuditEventRepository
org.springframework.boot.actuate.audit.AuditEvent[]
sun.misc.Launcher$AppClassLoader @ 0xe7020a30

禁用此内存审计事件的最佳方法是什么:

  1. 移除 spring-boot-acturtor 依赖
  2. management.endpoints.enabled-by-default=true
  3. endpoints.auditevents.enabled=false

提前致谢

【问题讨论】:

  • 在 Spring Boot 应用程序中使用 Hibernate 存在非常大的问题,这通常会导致内存泄漏。要验证这不是您的情况,请检查您的存储库并确保您没有任何带有 inselect 查询
  • 感谢您的建议!不知道!可能会有很大帮助。
  • 没问题,可以说这不是一个非常公开的信息,我费了很长时间才找到这个问题。另外,如果这是您的问题解决方案,请告诉我,我将我的评论作为答案,以便您将其选为正确的。提前致谢
  • 其实这不是我的问题。我的 pb 与暴露端点指标的 spring boot 执行器有关,特别是审计消耗大量内存的事件。

标签: spring-boot spring-boot-actuator


【解决方案1】:

遇到了同样的发现...

经过一些调查发现这不是泄漏,而是 Spring boot 存储了最后 4000 个安全(登录)审计事件。它会增长到那个数字,然后保持在那里......

您可以创建自己的实现,然后将其写入缓存或数据库,而不是将其保存在内存中..

(Reference)

【讨论】:

    猜你喜欢
    • 2018-10-11
    • 1970-01-01
    • 1970-01-01
    • 2017-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-08
    • 2013-11-06
    相关资源
    最近更新 更多