Mousius commented on pull request #8770:
URL: https://github.com/apache/tvm/pull/8770#issuecomment-902557489


   Hi @huanmei9,
   
   I would suggest that the current implementation of `custom_path` is robust, 
consider a typical task which does the following:
   1. Creates a temporary directory
   2. Writes some files
   3. Checks those files
   
   With the current behaviour, if two tasks attempt to do this in parallel 
(such as parallel tests from pytest-xdist), you get the following:
   1. Task A creates a temporary directory
   2. Task A writes some files
   3. Task B attempts to create a temporary directory - raises Exception that 
temporary directory already exists
   4. Task A checks those files
   Task B has failed as it tries to pollute the existing temporary directory.
   
   With this change, you can instead have:
   1. Task A creates a temporary directory
   2. Task A writes some files
   3. Task B attempts to create a temporary directory - no error raised
   4. Task B writes some files
   5. Task A checks those files - raises assertion error
   6. Task B checks those files
   Task A has now failed because of the pollution of the temporary directory 
and the error is also incorrectly attributed to Task A rather than Task B. This 
scenario only occurs intermittently and is therefore harder to debug.
   
   Therefore, I would suggest that the current implementation of temp dir helps 
to prevent such concurrency bugs and raises the correct error to ensure we use 
a new fresh temp directory per invocation - what are your thoughts?


-- 
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: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to