有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

SpringJava。lang.OutOfMemoryError:超出GC开销限制:应用程序部署在weblogic中

我们在weblogic 12c上部署了应用程序,我们在日志中看到间歇性的以下异常

java.lang.OutOfMemoryError: GC overhead limit exceeded

当我同时看到应用程序log4j日志时,我可以看到以下异常

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: weblogic.jdbc.extensions.PoolLimitSQLException: weblogic.common.resourcepool.ResourceLimitException: No resources currently available in pool TMP_DS_RW to allocate to applications, please increase the size of the pool and retry.. Error Code: 0

Caused by: weblogic.jdbc.extensions.PoolLimitSQLException: weblogic.common.resourcepool.ResourceLimitException: No resources currently available in pool TMP_DS_RW to allocate to applications, please increase the size of the pool and retry..

发生这种情况是因为池中的连接数已耗尽吗

weblogic的连接池大小与java之间是否存在任何关系。lang.OutOfMemoryError

因为每当池连接似乎耗尽时,我们就要面对java。lang.OutOfMemoryError

我们已经尝试将堆大小从1GB增加到2GB,但仍然面临java。一段时间后,lang.OutOfMemoryError出现错误

在问题中使用eclipse堆转储分析器后,怀疑它正在显示

The class "java.lang.ref.Finalizer", loaded by "system class loader", occupies 9,935,880 (69.45%) bytes.

注意:在weblogic中jndi datsource配置的连接池选项卡中,最大容量设置为30,我们正在使用oracle数据库


共 (3) 个答案

  1. # 1 楼答案

    您是否尝试从WebLogic控制台监视连接? 服务->;数据来源->;(选择您的数据源)>;(选项卡)监控,在那里您应该有一个连接的“实时”视图

  2. # 2 楼答案

    爪哇。lang.OutOfMemoryError:超出GC开销限制

    当满足以下所有条件时,将引发此错误:

    1. The amount of time spent in full GCs exceeds the value specified by the -XX:GCTimeLimit=N flag. The default value is 98 (i.e., if 98% of the time is spent in GC).
    2. The amount of memory reclaimed by a full GC is less than the value specified by the -XX:GCHeapFreeLimit=N flag. The default value for this is 2, meaning that if less than 2% of the heap is freed during the full GC, this condition is met.
    3. The above two conditions have held true for five consecutive full GC cycles (that value is not tunable). Heap Analysis | 187
    4. The value of the -XX:+UseGCOverheadLimit flag is true (which it is by default).

    来源:Java性能,权威指南

    如果增加堆大小无法解决问题,请检查CPU是否不是瓶颈

    -XX:+PrintGCDetails
    -Xloggc:<path>
    

    这将把有关GC的信息记录到。如果您看到堆大小不断增加,那么您就有内存泄漏,并且可能没有关闭连接

  3. # 3 楼答案

    这是可能的,因为数据库连接使用内存。您的应用程序必须泄漏连接池。尝试查看应用程序代码,并检查它是否在使用后正确释放数据库连接