Archived

This forum has been archived. Please start a new discussion on GitHub.

Java heap OutOfMemory in compress

Hi,
We are running IceStorm 3.6 collector and send messages with compression on CentOS 6 JDK 8. After running ~4 hours, java heap is used up (we set the heap max size to 8192m), and got the following exceptions.

Not sure if it is caused by too many CBZip2OutputStream instances created?

  1. one is from qSort3:
    java.lang.OutOfMemoryError: Java heap space
    at org.apache.tools.bzip2.CBZip2OutputStream.qSort3(CBZip2OutputStream.java:1039)
    at org.apache.tools.bzip2.CBZip2OutputStream.mainSort(CBZip2OutputStream.java:1285)
    at org.apache.tools.bzip2.CBZip2OutputStream.doReversibleTransformation(CBZip2OutputStream.java:1385)
    at org.apache.tools.bzip2.CBZip2OutputStream.endBlock(CBZip2OutputStream.java:476)
    at org.apache.tools.bzip2.CBZip2OutputStream.writeRun(CBZip2OutputStream.java:405)
    at org.apache.tools.bzip2.CBZip2OutputStream.write(CBZip2OutputStream.java:355)
    at java.io.OutputStream.write(OutputStream.java:116)
    at IceInternal.BasicStream.compress(BasicStream.java:2596)
    at Ice.ConnectionI.doCompress(ConnectionI.java:2277)
    at Ice.ConnectionI.sendMessage(ConnectionI.java:2209)
    at Ice.ConnectionI.sendAsyncRequest(ConnectionI.java:395)
    at IceInternal.ProxyFlushBatch.invokeRemote(ProxyFlushBatch.java:42)
    at IceInternal.ConnectRequestHandler.flushRequestsImpl(ConnectRequestHandler.java:313)
    at IceInternal.ConnectRequestHandler.flushRequests(ConnectRequestHandler.java:289)
    at IceInternal.ConnectRequestHandler.setConnection(ConnectRequestHandler.java:154)
    at IceInternal.RoutableReference$3.setConnection(RoutableReference.java:847)
    at IceInternal.OutgoingConnectionFactory$ConnectCallback.setConnection(OutgoingConnectionFactory.java:957)
    at IceInternal.OutgoingConnectionFactory.finishGetConnection(OutgoingConnectionFactory.java:651)
    at IceInternal.OutgoingConnectionFactory.access$300(OutgoingConnectionFactory.java:12)
    at IceInternal.OutgoingConnectionFactory$ConnectCallback.connectionStartCompleted(OutgoingConnectionFactory.java:866)
    at Ice.ConnectionI.dispatch(ConnectionI.java:1097)
    at Ice.ConnectionI.message(ConnectionI.java:1056)
    at IceInternal.ThreadPool.run(ThreadPool.java:395)
    at IceInternal.ThreadPool.access$300(ThreadPool.java:12)
    at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:832)
    at java.lang.Thread.run(Thread.java:745)

  2. the other one:
    Ice.CompressionException
    reason = "bzip2 compression failure"
    at IceInternal.BasicStream.compress(BasicStream.java:2602)
    at Ice.ConnectionI.doCompress(ConnectionI.java:2277)
    at Ice.ConnectionI.sendMessage(ConnectionI.java:2209)
    at Ice.ConnectionI.sendAsyncRequest(ConnectionI.java:395)
    at IceInternal.ProxyFlushBatch.invokeRemote(ProxyFlushBatch.java:42)
    at IceInternal.ConnectRequestHandler.flushRequestsImpl(ConnectRequestHandler.java:313)
    at IceInternal.ConnectRequestHandler.flushRequests(ConnectRequestHandler.java:289)
    at IceInternal.ConnectRequestHandler.setConnection(ConnectRequestHandler.java:154)
    at IceInternal.RoutableReference$3.setConnection(RoutableReference.java:847)
    at IceInternal.OutgoingConnectionFactory$ConnectCallback.setConnection(OutgoingConnectionFactory.java:957)
    at IceInternal.OutgoingConnectionFactory.finishGetConnection(OutgoingConnectionFactory.java:651)
    at IceInternal.OutgoingConnectionFactory.access$300(OutgoingConnectionFactory.java:12)
    at IceInternal.OutgoingConnectionFactory$ConnectCallback.connectionStartCompleted(OutgoingConnectionFactory.java:866)
    at Ice.ConnectionI.dispatch(ConnectionI.java:1097)
    at Ice.ConnectionI.message(ConnectionI.java:1056)
    at IceInternal.ThreadPool.run(ThreadPool.java:395)
    at IceInternal.ThreadPool.access$300(ThreadPool.java:12)
    at IceInternal.ThreadPool$EventHandlerThread.run(ThreadPool.java:832)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at IceInternal.BasicStream.compress(BasicStream.java:2595)
    ... 18 more
    Caused by: java.lang.OutOfMemoryError: Java heap space
    at org.apache.tools.bzip2.CBZip2OutputStream.allocateCompressStructures(CBZip2OutputStream.java:1545)
    at org.apache.tools.bzip2.CBZip2OutputStream.(CBZip2OutputStream.java:334)
    ... 22 more

Tagged:

Comments

  • benoit
    benoit Rennes, France

    Hi,

    Sorry for the late answer... we're not aware of any leaks with the Bzip2 library on Java. I was able to run a modified hello demo that sends compressed batch oneway requests in a tight loop for several hours without noticing any leaks.

    Were you able to resolve the problem? If not, are you able to reproduce the leak with a small test case?

    Also note that the failure to allocate memory here doesn't necessarily indicate that it's the responsible of the leak, the leak could be elsewhere.

    Cheers,
    Benoit.