fanyunbojerry commented on a change in pull request #28389:
URL: https://github.com/apache/spark/pull/28389#discussion_r416758545



##########
File path: 
common/unsafe/src/main/java/org/apache/spark/unsafe/memory/HeapMemoryAllocator.java
##########
@@ -50,7 +50,7 @@ public MemoryBlock allocate(long size) throws 
OutOfMemoryError {
     long alignedSize = numWords * 8L;
     assert (alignedSize >= size);
     if (shouldPool(alignedSize)) {
-      synchronized (this) {
+      synchronized (bufferPoolsBySize) {

Review comment:
       You're right. I checked my executor log again and I find the executor 
got NPE first
   ```
   java.lang.NullPointerException
        at 
org.apache.spark.unsafe.memory.HeapMemoryAllocator.allocate(HeapMemoryAllocator.java:58)
        at 
org.apache.spark.memory.TaskMemoryManager.allocatePage(TaskMemoryManager.java:302)
        at 
org.apache.spark.memory.MemoryConsumer.allocateArray(MemoryConsumer.java:96)
        at 
org.apache.spark.unsafe.map.BytesToBytesMap.allocate(BytesToBytesMap:800)
        ...
   ```
    And later got the NoSuchElementExceptionException.
   ```
   java.util.NoSuchElementExceptionException
           at java.util.LinkedList.removeFirst(LinkedList.java:270)
           at java.util.LinkedList.remove(LinkedList.java:685)
        at 
org.apache.spark.unsafe.memory.HeapMemoryAllocator.allocate(HeapMemoryAllocator.java:57)
        at 
org.apache.spark.memory.TaskMemoryManager.allocatePage(TaskMemoryManager.java:302)
        at 
org.apache.spark.memory.MemoryConsumer.allocateArray(MemoryConsumer.java:96)
        at 
org.apache.spark.unsafe.map.BytesToBytesMap.allocate(BytesToBytesMap:800)
        ...
   ```
   But I can't find out why NPE error here. Maybe a null WeakReference<long[]> 
added?
   I updated the JIRA SPARK-31592.




----------------------------------------------------------------
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:
[email protected]



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

Reply via email to