theosib-amazon commented on PR #959:
URL: https://github.com/apache/parquet-mr/pull/959#issuecomment-1127885617

   > My question is when a thread exits, we don't have a corresponding evict 
operation on the map. Using thread pool might be OK if the thread object is not 
changed, but not sure if there is a scenario where threads are created/exited 
quickly and we leak in that case.
   
   No matter what thread release() is called from, it will clean up all 
(de)compressors from all threads. I designed it specifically this way so that a 
leak won't happen. As long as close/release is called when it should be.
   
   Note that it's not appropriate to call close or release while 
(de)compression is still going on. If someone does that, it might still work, 
but it would be a protocol violation. The usage pattern should be:
   
   - Create Codec factory
   - Create worker threads
   - Threads create codecs
   - Threads finish using codecs
   - Threads terminate
   - The thread that created the worker threads waits until those threads are 
done
   - close/release is called.
   
   Someone might do something different, but that would be a bug no different 
from someone closing a file in one thread while it's being written to in 
another.


-- 
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]

Reply via email to