[ 
https://issues.apache.org/jira/browse/TEZ-4763?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Denys Kuzmenko updated TEZ-4763:
--------------------------------
    Description: 
With tez.runtime.enable.final-merge.in.output=false, each spill sends its own 
events: SpillCallback.onSuccess appends them to finalEvents from the spill 
thread. finalEvents is a plain LinkedList, and spill callbacks can finish at 
the same time on different threads:                                             
                                                                                
                     
 - Lost node, size kept: a null slot becomes TezEvent(null), which fails with 
"Unknown event". The attempt fails visibly and is retried.                      
                                                 - Lost node and lost size 
increment: the list stays consistent but is one event short. The consumer waits 
forever for the missing spill, a silent hang.                                   
                   
                                                                                
                                                                                
                                              
A second race: a spill callback releases its slot while it is still running on 
its pool thread. The next spill submit then finds no idle thread, and the 
SynchronousQueue throws RejectedExecutionException. 
                                                                                
                                                                                
                                              
Two spills in flight at once is routine; in a TPC-DS 10 TB run, 218 attempts of 
one map vertex had two pool spills in flight. A collision needs the callbacks 
to overlap almost exactly, so it is rare. A stress test (4 KiB buffers × 64, 
200k records, 40 writers per round) reproduces both modes, e.g. 612 spills but 
611 spill events.                                                               
             
                                                                                
                                                                                
                                              
Fix: make finalEvents a synchronized list. Give the spill pool a fixed size and 
a LinkedBlockingQueue, with idle threads timing out. availableSlots still 
limits how many spills run at once.                
 

> UnorderedPartitionedKVWriter: concurrent spills can lose a spill event or 
> have a spill rejected
> -----------------------------------------------------------------------------------------------
>
>                 Key: TEZ-4763
>                 URL: https://issues.apache.org/jira/browse/TEZ-4763
>             Project: Apache Tez
>          Issue Type: Bug
>            Reporter: Denys Kuzmenko
>            Priority: Major
>
> With tez.runtime.enable.final-merge.in.output=false, each spill sends its own 
> events: SpillCallback.onSuccess appends them to finalEvents from the spill 
> thread. finalEvents is a plain LinkedList, and spill callbacks can finish at 
> the same time on different threads:                                           
>                                                                               
>                          
>  - Lost node, size kept: a null slot becomes TezEvent(null), which fails with 
> "Unknown event". The attempt fails visibly and is retried.                    
>                                                    - Lost node and lost size 
> increment: the list stays consistent but is one event short. The consumer 
> waits forever for the missing spill, a silent hang.                           
>                            
>                                                                               
>                                                                               
>                                                   
> A second race: a spill callback releases its slot while it is still running 
> on its pool thread. The next spill submit then finds no idle thread, and the 
> SynchronousQueue throws RejectedExecutionException. 
>                                                                               
>                                                                               
>                                                   
> Two spills in flight at once is routine; in a TPC-DS 10 TB run, 218 attempts 
> of one map vertex had two pool spills in flight. A collision needs the 
> callbacks to overlap almost exactly, so it is rare. A stress test (4 KiB 
> buffers × 64, 200k records, 40 writers per round) reproduces both modes, e.g. 
> 612 spills but 611 spill events.                                              
>                               
>                                                                               
>                                                                               
>                                                   
> Fix: make finalEvents a synchronized list. Give the spill pool a fixed size 
> and a LinkedBlockingQueue, with idle threads timing out. availableSlots still 
> limits how many spills run at once.                
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to