anirudh2290 commented on issue #9681: Better Exception Handling for Operators
URL: https://github.com/apache/incubator-mxnet/pull/9681#issuecomment-363535323
 
 
   ```
   try:
        x, y, z = op()
        x.asnumpy() #Throws exception, sets exception_ptr to nullptr
   except:
        handle_exc()
   y.asnumpy() #exception_ptr is nullptr, doesn't throw
   y = op2(y)  
   y.asnumpy() # y may have garbage values, op2 may execute just fine, 
exception_ptr still nullptr, doesn't throw ?
   ```
   
   @piiswrong As depicted in the example above, if we decide to invalidate 
exception_ptr for y by setting it to nullptr when we WaitToRead x (I am unsure 
how we will do this), then we won't be propagating exceptions down the chain. 
Therefore, the last line here will execute just fine instead of throwing an  
exception, and user will end up with garbage values for y. 
   
   I understand your point that if an op has multiple write vars, and if we 
waited for one of the write vars and re-threw exception, we shouldn't throw it 
again for other vars. But, if we end up invalidating the exception_ptr, any 
continuing operators may or may not fail, and since the exception_ptr is 
invalidated we wouldn't be re-throwing the exception in any of the following 
WaitToReads.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to