开发者

Long transaction in WebSphere 6.1 results in OutOfMemoryException

I’m running a synchronization / batch job (synchronizeXXX() that inserts 111821 records in an Oracle database using Hibernate 3.2.5GA / Spring 2.5.6 in one long running transaction (>4 hours) but it fails after approx. 2 hours / 50000 records with an OutOfMemory exception.

Although i do clear and flush every 20 inserts, it still looks like Hibernate/Websphere/Spring (?) is holding on to a gazillion objects in the session.

The funny thing is: the memory usage is initially normal, but after approx. 20/30 minutes the memory usage starts to increase and grows until the OutOfMemory occurs (not shown in PDF because it was scrolled out/cleared or something). I tried upgrading Hibernate from 3.2.5 to 3.3.2GA but the same problem remained. When I increase the max heap size, the OutOfMemory just comes later.

I googled and found some ‘similar’ issues, but they used Hibernate to manage the transaction instead of Spring, so I guess the fix mentioned is not relevant to me(?). See Simular issues

I analysed the heap dumps and did some analysis with the IBM Supp开发者_开发技巧ort Agent 4.1. All results/screenshots and more details are included in a PDF: see OutOfMemory analysis (PDF 586KB)

Any help is appreciated!


Even if you are doing clears and flush from time to time the Hibernate session and transaction is still open and clear doesn't seem to work as it should in your case.

The options here seem to be:

a) Use stateless session: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html

b) Use SQL queries so hibernate cannot hold anything

c) Use several transactions

There is no great solution here, so just value the best option for you :(

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜