APPSTATS导致java内存不足错误

APPSTATS导致java内存不足错误

本文介绍了Java Appengine APPSTATS导致java内存不足错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的java appengine应用程序中有几个servlet在内存中进行排序,并且完成了几秒的完成。这些完全没有错误。然而,我最近启用了appstats for appengine,并开始收到以下错误:

  java.lang.OutOfMemoryError:Java堆空间$ java.util.Arrays.copyOf处的
(未知源)$ b $ java.util.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.append(未知源)$ b $在java.lang.StringBuilder.append(未知源)
在java.lang.StringBuilder.append(未知源)
在java。 lang.StringBuilder.append(未知来源)
,位于com.google.appengine.repackaged.com.google.protobuf.TextFormat $ TextGenerator.write(TextFormat.java:344)
com.google.appengine .repackaged.com.google.protobuf.TextFormat $ TextGenerator.print(TextFormat.java:332)
at com.google.appengine.repackaged.com.google.protobuf.TextFormat.printUnknownFields(TextFormat.java:249)
,位于com.google.appengine.repackaged.com.google.protobuf.TextFormat.print(TextFormat.java:4 7)
,位于com.google.appengine.repackaged.com.google.protobuf.TextFormat.printToString(TextFormat.java:73)
位于com.google.appengine.tools.appstats.Recorder.makeSummary( Recorder.java:157)
,位于com.google.appengine.tools.appstats.Recorder.makeSyncCall(Recorder.java:239)
位于com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy。的java:98)
。在com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:54)
。在com.google.appengine.api.datastore.PreparedQueryImpl.runQuery(PreparedQueryImpl。 Java的:在org.datanucleus.store.appengine.query.DatastoreQuery.fulfillEntityQuery(DatastoreQuery在com.google.appengine.api.datastore.PreparedQueryImpl.asQueryResultList 127)
(PreparedQueryImpl.java:81)
。 Java的:379)
处org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery org.datanucleus.store.appengine.query.DatastoreQuery.executeQuery(DatastoreQuery.java:289)
。 java的:23 9)
at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:89)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:243)
at com .poo.pooserver.dataaccess.DataAccessHelper.getPooStream(DataAccessHelper.java:204)
在com.poo.pooserver.GetPooStreamServlet.doPost(GetPooStreamServlet.java:58)
在javax.servlet.http.HttpServlet 。服务(HttpServlet.java:713)
在javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
在org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java :511)
在org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1166)
在com.google.appengine.tools.appstats.AppstatsFilter.doFilter(AppstatsFilter.java :92)
at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doF ilter(ServletHandler.java:1157)


解决方案

这可以帮助您减少OutOfMemoryErrors的发生:

 <滤光器> 
< filter-name> appstats< / filter-name>
< filter-class> com.google.appengine.tools.appstats.AppstatsFilter< / filter-class>
< init-param>
< param-name> maxLinesOfStackTrace< / param-name>
< param-value> 16< / param-value>
< / init-param>
< / filter>


I have several servlets in my java appengine app that do in memory sorting and take on the order of seconds to complete. These complete error free.

However, I recently enabled appstats for appengine and started receiving the following error:

java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Unknown Source)
    at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
    at java.lang.AbstractStringBuilder.append(Unknown Source)
    at java.lang.StringBuilder.append(Unknown Source)
    at java.lang.StringBuilder.append(Unknown Source)
    at java.lang.StringBuilder.append(Unknown Source)
    at com.google.appengine.repackaged.com.google.protobuf.TextFormat$TextGenerator.write(TextFormat.java:344)
    at com.google.appengine.repackaged.com.google.protobuf.TextFormat$TextGenerator.print(TextFormat.java:332)
    at com.google.appengine.repackaged.com.google.protobuf.TextFormat.printUnknownFields(TextFormat.java:249)
    at com.google.appengine.repackaged.com.google.protobuf.TextFormat.print(TextFormat.java:47)
    at com.google.appengine.repackaged.com.google.protobuf.TextFormat.printToString(TextFormat.java:73)
    at com.google.appengine.tools.appstats.Recorder.makeSummary(Recorder.java:157)
    at com.google.appengine.tools.appstats.Recorder.makeSyncCall(Recorder.java:239)
    at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:98)
    at com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:54)
    at com.google.appengine.api.datastore.PreparedQueryImpl.runQuery(PreparedQueryImpl.java:127)
    at com.google.appengine.api.datastore.PreparedQueryImpl.asQueryResultList(PreparedQueryImpl.java:81)
    at org.datanucleus.store.appengine.query.DatastoreQuery.fulfillEntityQuery(DatastoreQuery.java:379)
    at org.datanucleus.store.appengine.query.DatastoreQuery.executeQuery(DatastoreQuery.java:289)
    at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:239)
    at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:89)
    at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
    at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
    at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:243)
    at com.poo.pooserver.dataaccess.DataAccessHelper.getPooStream(DataAccessHelper.java:204)
    at com.poo.pooserver.GetPooStreamServlet.doPost(GetPooStreamServlet.java:58)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.tools.appstats.AppstatsFilter.doFilter(AppstatsFilter.java:92)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
解决方案

I wonder whether this can help you reducing the occurence of OutOfMemoryErrors:How to reduce the memory usage of Appstats on Google App Engine Java

<filter>
  <filter-name>appstats</filter-name>
    <filter-class>com.google.appengine.tools.appstats.AppstatsFilter</filter-class>
    <init-param>
      <param-name>maxLinesOfStackTrace</param-name>
      <param-value>16</param-value>
    </init-param>
</filter>

这篇关于Java Appengine APPSTATS导致java内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 01:31