You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2020/03/17 00:54:39 UTC

[GitHub] [hadoop] DadanielZ commented on a change in pull request #1890: HADOOP-16854 Fix to prevent OutOfMemoryException and Make the threadpool and bytebuffer pool common across all AbfsOutputStream instances

DadanielZ commented on a change in pull request #1890: HADOOP-16854 Fix to prevent OutOfMemoryException and Make the threadpool and bytebuffer pool common across all AbfsOutputStream instances
URL: https://github.com/apache/hadoop/pull/1890#discussion_r393387356
 
 

 ##########
 File path: hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsOutputStream.java
 ##########
 @@ -285,14 +311,22 @@ private synchronized void writeCurrentBufferToService() throws IOException {
 
     final byte[] bytes = buffer;
     final int bytesLength = bufferIndex;
-    buffer = byteBufferPool.getBuffer(false, bufferSize).array();
     bufferIndex = 0;
     final long offset = position;
     position += bytesLength;
 
-    if (threadExecutor.getQueue().size() >= maxConcurrentRequestCount * 2) {
+    if (Runtime.getRuntime().freeMemory() < MIN_MEMORY_THRESHOLD
+        && buffersToBeReturned.get() > 0) {
+      LOG.debug("Low memory");
 
 Review comment:
   what if` Runtime.getRuntime().freeMemory() < MIN_MEMORY_THRESHOLD` but `buffersToBeReturned.get()` is `0`?
   Can we make the LOG more meaningful like  "Low memory, less than 100 MB is available, the existing read tasks consumes 2048 MB, waiting for completion."
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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