ChickenBenny commented on code in PR #77489:
URL: https://github.com/apache/airflow/pull/77489#discussion_r4696928592


##########
go-sdk/sdk/errors.go:
##########
@@ -44,3 +44,8 @@ var XComNotFound = errors.New("xcom not found")
 //
 // See the “Get“ method of [TaskStateStore] for an example
 var TaskStateNotFound = errors.New("task state not found")
+
+// ErrTaskTimeout is the cause of a task's context when the task runs past its 
execution_timeout.
+// Check errors.Is(context.Cause(ctx), ErrTaskTimeout) to tell a timeout from 
a shutdown of the task,
+// for example to decide what to clean up. A task that times out fails, 
whatever it returns.
+var ErrTaskTimeout = errors.New("task timed out")

Review Comment:
   Fixed in c6d5f8d87b. The goroutine now cancels the context itself as soon as 
the task returns, then reads the cause and sends it with the result. Whichever 
cancels the context first sets the cause, so the timer can no longer change it 
after the task has returned.
   
   This is a timing race, so I didn't find a deterministic test for it. The 
existing timeout tests still cover both outcomes.



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