Java Appengine APPSTATS导致java内存不足错误

时间:2010-04-18 20:49:09

标签: java google-app-engine appstats

我的java appengine应用程序中有几个servlet,用于内存排序,并按照几秒钟的顺序完成。这些完全没有错误。

但是,我最近启用了appstats for appengine并开始收到以下错误:

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)

2 个答案:

答案 0 :(得分:1)

Appstats本身使用内存,可以在一定程度上减少Java应用程序的可用内存量,但减少量应该很小。 Appstats本身也可能耗尽内存(通常在内存缓存调用期间看到link text),但您的应用程序似乎并非如此。我会看看你是否可以采取任何措施将工作分解成更小的部分。)

答案 1 :(得分:1)

我想知道这是否可以帮助您减少OutOfMemoryError的发生: 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>