Forums de discussion

(Liferay 6.1.3)OutOfMemory when loading web content

Ashish Ashok, modifié il y a 8 années.

(Liferay 6.1.3)OutOfMemory when loading web content

New Member Publications: 11 Date d'inscription: 18/06/13 Publications récentes
As of now I have 155,454 Journal Articles with multiple versions in liferay. When ever I try to load the webcontent, I get OutOfMemoryError. But after some time(very slow), liferay does load journal articles into web content page. I have set my application server to have 4gb of memory (-Xmx4096m). How do I resolve this issue?

Exception in thread "liferay/scheduler_dispatch-1" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOfRange(Arrays.java:2694)
	at java.lang.String.<init>(String.java:203)
	at java.nio.HeapCharBuffer.toString(HeapCharBuffer.java:561)
	at java.nio.CharBuffer.toString(CharBuffer.java:1201)
	at com.mysql.jdbc.StringUtils.toString(StringUtils.java:1871)
	at com.mysql.jdbc.ResultSetRow.getString(ResultSetRow.java:821)
	at com.mysql.jdbc.BufferRow.getString(BufferRow.java:542)
	at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5816)
	at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5693)
	at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5733)
	at com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
	at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
	at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230)
	at com.liferay.portal.dao.orm.hibernate.StringType.nullSafeGet(StringType.java:99)
	at org.hibernate.type.CompositeCustomType.nullSafeGet(CompositeCustomType.java:213)
	at org.hibernate.type.AbstractType.hydrate(AbstractType.java:104)
	at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
	at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
	at org.hibernate.loader.Loader.getRow(Loader.java:1355)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
	at org.hibernate.loader.Loader.doQuery(Loader.java:829)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
	at org.hibernate.loader.Loader.doList(Loader.java:2542)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
	at org.hibernate.loader.Loader.list(Loader.java:2271)
	at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
	at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
	at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)</init>
thumbnail
Ramalingaiah. D, modifié il y a 8 années.

RE: (Liferay 6.1.3)OutOfMemory when loading web content

Expert Publications: 486 Date d'inscription: 16/08/14 Publications récentes
Hi Ashish Ashok,

-Xmx1024m -XX:MaxPermSize=512m

you can do tomcat size increase ,



Regards
Ram
Ashish Ashok, modifié il y a 8 années.

RE: (Liferay 6.1.3)OutOfMemory when loading web content

New Member Publications: 11 Date d'inscription: 18/06/13 Publications récentes
Thanks for the reply Ramalingaiah. I have my heap memory at 4gb -Xmx4096m. Its not permgen issue though
thumbnail
Amos Fong, modifié il y a 8 années.

RE: (Liferay 6.1.3)OutOfMemory when loading web content

Liferay Legend Publications: 2047 Date d'inscription: 07/10/08 Publications récentes
What is on the page? Do you have custom code or a template? are you doing a query that returns all 155,454 journal articles and therefore loading them all into memory? If so you want to adjust your query to return a subset of the results by setting a start and end value to the SQL query.
Ashish Ashok, modifié il y a 8 années.

RE: (Liferay 6.1.3)OutOfMemory when loading web content

New Member Publications: 11 Date d'inscription: 18/06/13 Publications récentes
We have JournalArticles on the page. We have our own JournalStruture and JournalTemplate. I am using XSLT for JournalTemplates. Is that a problem? Should we be using velocity marker template instead? (I don't think it is an issue)

regarding, "are you doing a query that returns all 155,454 journal articles and therefore loading them all into memory?"
I did not create any hook to change the existing Liferay code base. I just go to the webcontent section in the control panel to view the Journal Articles. We have been adding Journal Articles through JSON RPC Webservices

Unfortunately, that was the complete stacktrace. I click on the webcontent, I get the stacktrace I provided. But after say like 10minutes I am able to view the JournalArticles in the webcontent page and do navigation.
thumbnail
Amos Fong, modifié il y a 8 années.

RE: (Liferay 6.1.3)OutOfMemory when loading web content

Liferay Legend Publications: 2047 Date d'inscription: 07/10/08 Publications récentes
I agree with Olaf, taking a heap dump will tell if it's actually JournalArticle or not taking up all the memory.

That said, a possible lead I noticed is in the stack trace this error is in scheduled job because the thread is "liferay/scheduler_dispatch-1". Try looking at JournalArticleLocalService.checkArticles() for hints. Do all 155,454 articles expire at the same time?
Ashish Ashok, modifié il y a 8 années.

RE: (Liferay 6.1.3)OutOfMemory when loading web content (Réponse)

New Member Publications: 11 Date d'inscription: 18/06/13 Publications récentes
Increasing the memory solved the issue for me. Thank you.

https://dev.liferay.com/discover/portal/-/knowledge_base/6-1/performance-tuning
thumbnail
Olaf Kock, modifié il y a 8 années.

RE: (Liferay 6.1.3)OutOfMemory when loading web content

Liferay Legend Publications: 6396 Date d'inscription: 23/09/08 Publications récentes
It'd be interesting to see where this occurs - you're omitting the rest of your stacktrace. Is this happening because you (or Liferay) tries to read all the articles at once? Also, it might not be tied to exactly this occurrence: If your application is extremely memory hungry, anything might trigger an Out Of Memory condition.

You could analyse a HeapDump to see what objects are actually in memory and if there's a possible leak.

Please provide more data - e.g. the full stacktrace.