agent/acs/handler/payload_handler.go
func (payloadHandler *payloadRequestHandler) handleUnrecognizedTask(task *ecsacs.Task, err error, payload *ecsacs.PayloadMessage) {
	seelog.Warnf("Received unexpected acs message, messageID: %s, task: %v, err: %v",
		aws.StringValue(payload.MessageId), aws.StringValue(task.Arn), err)

	if aws.StringValue(task.Arn) == "" {
		seelog.Criticalf("Received task with no arn, messageId: %s", aws.StringValue(payload.MessageId))
		return
	}

	// Only need to stop the task; it brings down the containers too.
	taskEvent := api.TaskStateChange{
		TaskARN: *task.Arn,
		Status:  apitaskstatus.TaskStopped,
		Reason:  UnrecognizedTaskError{err}.Error(),
		// The real task cannot be extracted from payload message, so we send an empty task.
		// This is necessary because the task handler will not send an event whose
		// Task is nil.
		Task: &apitask.Task{},
	}

	payloadHandler.taskHandler.AddStateChangeEvent(taskEvent, payloadHandler.ecsClient)
}
func (payloadHandler *payloadRequestHandler) handleUnrecognizedTask(task *ecsacs.Task, err error, payload *ecsacs.PayloadMessage) {
	seelog.Warnf("Received unexpected acs message, messageID: %s, task: %v, err: %v",
		aws.StringValue(payload.MessageId), aws.StringValue(task.Arn), err)

	if aws.StringValue(task.Arn) == "" {
		seelog.Criticalf("Received task with no arn, messageId: %s", aws.StringValue(payload.MessageId))
		return
	}

	// Only need to stop the task; it brings down the containers too.
	taskEvent := api.TaskStateChange{
		TaskARN: *task.Arn,
		Status:  apitaskstatus.TaskStopped,
		Reason:  UnrecognizedTaskError{err}.Error(),
		// The real task cannot be extracted from payload message, so we send an empty task.
		// This is necessary because the task handler will not send an event whose
		// Task is nil.
		Task: &apitask.Task{},
	}

	payloadHandler.taskHandler.AddStateChangeEvent(taskEvent, payloadHandler.ecsClient)
}
// handleUnrecognizedTask handles unrecognized tasks by sending 'stopped' with
// a suitable reason to the backend