You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "zhengchenyu (via GitHub)" <gi...@apache.org> on 2023/08/17 02:41:05 UTC

[GitHub] [incubator-uniffle] zhengchenyu opened a new issue, #1152: [Bug] Direct memory may leak in shuffle server.

zhengchenyu opened a new issue, #1152:
URL: https://github.com/apache/incubator-uniffle/issues/1152

   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   
   
   ### Search before asking
   
   - [X] I have searched in the [issues](https://github.com/apache/incubator-uniffle/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Describe the bug
   
   Direct memory may leak in shuffle server.
   
   In client side, some task failed, Found error log:`due to io.grpc.StatusRuntimeException: DEADLINE_EXCEEDED: deadline exceeded after 59.999950602s.`
   
   And then I found shuffle server have many oom log:
   ```
   Exception in thread "Grpc-3250" java.lang.OutOfMemoryError: Direct buffer memory
   	at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
   	at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
   	at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
   	at io.grpc.netty.shaded.io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:648)
   	at io.grpc.netty.shaded.io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:623)
   	at io.grpc.netty.shaded.io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:202)
   	at io.grpc.netty.shaded.io.netty.buffer.PoolArena.tcacheAllocateNormal(PoolArena.java:186)
   ```
   
   Monitor shows that the direct memory of shuffle server have reached 80G (MaxDirectMemorySize is just 80G).
   
   ### Affects Version(s)
   
   master
   
   ### Uniffle Server Log Output
   
   _No response_
   
   ### Uniffle Engine Log Output
   
   _No response_
   
   ### Uniffle Server Configurations
   
   _No response_
   
   ### Uniffle Engine Configurations
   
   _No response_
   
   ### Additional context
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi closed issue #1152: [Bug] Direct memory may leak in shuffle server.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi closed issue #1152: [Bug] Direct memory may leak in shuffle server.
URL: https://github.com/apache/incubator-uniffle/issues/1152


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] zhengchenyu commented on issue #1152: [Bug] Direct memory may leak in shuffle server.

Posted by "zhengchenyu (via GitHub)" <gi...@apache.org>.
zhengchenyu commented on issue #1152:
URL: https://github.com/apache/incubator-uniffle/issues/1152#issuecomment-1681535561

   We add these startup options to analyse:
   ```
   -Dio.netty.leakDetection.level=PARANOID -XX:NativeMemoryTracking=detail
   ```
   
   Then we found these logs
   
   ```
   [ERROR] 2023-08-16 12:56:11,453 Grpc-146 ResourceLeakDetector reportTracedLeak - LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information.
   Recent access records: 
   #1:
           io.netty.buffer.AdvancedLeakAwareByteBuf.order(AdvancedLeakAwareByteBuf.java:71)
           io.netty.buffer.CompositeByteBuf.newComponent(CompositeByteBuf.java:346)
           io.netty.buffer.CompositeByteBuf.consolidate0(CompositeByteBuf.java:1758)
           io.netty.buffer.CompositeByteBuf.consolidateIfNeeded(CompositeByteBuf.java:571)
           io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:266)
           io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:222)
           org.apache.uniffle.server.buffer.ShuffleBuffer.updateShuffleData(ShuffleBuffer.java:272)
           org.apache.uniffle.server.buffer.ShuffleBuffer.getShuffleData(ShuffleBuffer.java:169)
           org.apache.uniffle.server.buffer.ShuffleBufferManager.getShuffleData(ShuffleBufferManager.java:231)
           org.apache.uniffle.server.ShuffleTaskManager.getInMemoryShuffleData(ShuffleTaskManager.java:516)
           org.apache.uniffle.server.ShuffleServerGrpcService.getMemoryShuffleData(ShuffleServerGrpcService.java:798)
           org.apache.uniffle.proto.ShuffleServerGrpc$MethodHandlers.invoke(ShuffleServerGrpc.java:1053)
           io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
           io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
           io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
           io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:352)
           io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
           io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
           io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
           java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
           java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
           java.base/java.lang.Thread.run(Thread.java:829)
   #2:
           io.netty.buffer.AdvancedLeakAwareByteBuf.writeBytes(AdvancedLeakAwareByteBuf.java:605)
           io.netty.buffer.CompositeByteBuf$Component.transferTo(CompositeByteBuf.java:1927)
           io.netty.buffer.CompositeByteBuf.consolidate0(CompositeByteBuf.java:1754)
           io.netty.buffer.CompositeByteBuf.consolidateIfNeeded(CompositeByteBuf.java:571)
           io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:266)
           io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:222)
           org.apache.uniffle.server.buffer.ShuffleBuffer.updateShuffleData(ShuffleBuffer.java:272)
           org.apache.uniffle.server.buffer.ShuffleBuffer.getShuffleData(ShuffleBuffer.java:169)
           org.apache.uniffle.server.buffer.ShuffleBufferManager.getShuffleData(ShuffleBufferManager.java:231)
           org.apache.uniffle.server.ShuffleTaskManager.getInMemoryShuffleData(ShuffleTaskManager.java:516)
           org.apache.uniffle.server.ShuffleServerGrpcService.getMemoryShuffleData(ShuffleServerGrpcService.java:798)
           org.apache.uniffle.proto.ShuffleServerGrpc$MethodHandlers.invoke(ShuffleServerGrpc.java:1053)
           io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
           io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
           io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
           io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:352)
           io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
           io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
           io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
           java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
           java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
           java.base/java.lang.Thread.run(Thread.java:829)
   Created at:
           io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:402)
           io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:188)
           io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:179)
           io.netty.buffer.CompositeByteBuf.allocBuffer(CompositeByteBuf.java:1872)
           io.netty.buffer.CompositeByteBuf.consolidate0(CompositeByteBuf.java:1751)
           io.netty.buffer.CompositeByteBuf.consolidateIfNeeded(CompositeByteBuf.java:571)
           io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:266)
           io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:222)
           org.apache.uniffle.server.buffer.ShuffleBuffer.updateShuffleData(ShuffleBuffer.java:272)
           org.apache.uniffle.server.buffer.ShuffleBuffer.getShuffleData(ShuffleBuffer.java:169)
           org.apache.uniffle.server.buffer.ShuffleBufferManager.getShuffleData(ShuffleBufferManager.java:231)
           org.apache.uniffle.server.ShuffleTaskManager.getInMemoryShuffleData(ShuffleTaskManager.java:516)
           org.apache.uniffle.server.ShuffleServerGrpcService.getMemoryShuffleData(ShuffleServerGrpcService.java:798)
           org.apache.uniffle.proto.ShuffleServerGrpc$MethodHandlers.invoke(ShuffleServerGrpc.java:1053)
           io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
           io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
           io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
           io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:352)
           io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:866)
           io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
           io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
           java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
           java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
           java.base/java.lang.Thread.run(Thread.java:829)
   ```
   
   We found NettyManagedBuffer in https://github.com/apache/incubator-uniffle/blob/5ac76e8179a7c038855d439bfbdc9bf759f3f108/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBuffer.java#L170 is never released in GRPC mode. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org


[GitHub] [incubator-uniffle] jerqi commented on issue #1152: [Bug] Direct memory may leak in shuffle server.

Posted by "jerqi (via GitHub)" <gi...@apache.org>.
jerqi commented on issue #1152:
URL: https://github.com/apache/incubator-uniffle/issues/1152#issuecomment-1681551645

   Great work!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org