Skip to content

TriggerEvent fires, and then defers a second time (doesn't fire a second time though). #18392

Closed

Description

@MatrixManAtYrService

Apache Airflow version

2.2.0b1 (beta snapshot)

Operating System

debian buster

Versions of Apache Airflow Providers

n/a

Deployment

Astronomer

Deployment details

Helm info:

helm repo add astronomer https://helm.astronomer.io
cat <<- 'EOF'  | helm install airflow astronomer/airflow --namespace airflow -f -
airflowVersion: 2.2.0
defaultAirflowRepository: myrepo
defaultAirflowTag: myimagetag
executor: KubernetesExecutor
images:
  airflow:
    repository: myrepo
    pullPolicy: Always
  pod_template:
    repository: myrepo
    pullPolicy: Always
triggerer:
  serviceAccount:
    create: True
EOF

Dockerfile:

FROM quay.io/astronomer/ap-airflow-dev:2.2.0-buster-43897
COPY ./dags/ ./dags/

the dag

What happened

Six tasks deferred for a random (but deterministic) amount of time, and the triggerer fired six events. Two of those events then deferred a second time, which wasn't necessary because they had already fired. Looks like a race condition.

Here are the triggerer logs: https://gist.github.com/MatrixManAtYrService/8d1d0c978465aa249e8bd0498cc08031#file-triggerer-log-L29

Note that most deferrals only appear once, but the ones for "Aligator" and "Bear" appear twice.

What you expected to happen

Six tasks deferred, six tasks fires, no extra deferrals.

How to reproduce

Run the dag in this gist with the kubernetes executor (be sure there's a triggerer running). Notice that some of the triggerer log messages appear nore than once. Those represent superfluous computation.

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. kaxil commented on Sep 20, 2021

    @kaxil
    Member
  2. andrewgodwin commented on Sep 21, 2021

    @andrewgodwin
    Contributor

    Yup, @MatrixManAtYrService and I discussed this yesterday. It's not a bad bug - triggers are designed to be re-entrant, and it won't resume the task twice - just something that needs cleaning up a little to save some cycles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions