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

   ### 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
   
   When client use grpc mode, the client's direct memory will OOM. See this log:
   
   ```
   io.grpc.netty.shaded.io.netty.util.internal.OutOfDirectMemoryError: failed 
to allocate 4194304 byte(s) of direct memory (used: 2671771927, max: 
2673344512)}  
   ```
   
   I do not find any memory leak. But I found that after #1773, each GrpcClient 
create one allocator. And I log the usage of each allocator, get these log:
   
   ```
   2024-09-03 17:09:45,518 [INFO] [client-data-transfer-44] 
|grpc.ShuffleServerGrpcClient|: ZCY DEBUG: after sendShuffleData use direct 
memory: 2671771927
   2024-09-03 17:09:45,518 [INFO] [client-data-transfer-15] 
|grpc.ShuffleServerGrpcClient|: ZCY DEBUG: show allocators: 
allocator#224559456, used heap memory0, used direct memory306184192
   allocator#503616849, used heap memory0, used direct memory306184192
   allocator#1415064557, used heap memory0, used direct memory297795584
   allocator#365979975, used heap memory0, used direct memory289406976
   allocator#1677896677, used heap memory0, used direct memory297795584
   allocator#1728835395, used heap memory0, used direct memory289406976
   allocator#1028869817, used heap memory0, used direct memory297795584
   allocator#2116109610, used heap memory0, used direct memory293601280
   allocator#1354539648, used heap memory0, used direct memory293601280
   total memory: heap=0direct=2671771648
   ```
   
   Obviously, the excessive memory usage is caused by creating an allocator for 
each GrpcClient. Before #1773, all GrpcClient functions use the same instance: 
PooledByteBufAllocator.DEFAULT.
   
   Here we need a static allocator.
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to