Skip to content

Airflow crashes when DAG run triggered by POST request with oversized conf #14159

Closed

Description

@THEdavehogue

Apache Airflow version: 1.10.4

What happened:

I recently discovered the upper limits of the Airflow experimental API when passing a conf that was too long (~100KB, very long text). I think there should be some error handling to detect when the conf in a POST request via the API is truncated.

I didn't save the error message but it was something from SqlAlchemy trying to write a truncated JSON so the parsing didn't work properly

What you expected to happen:

There should be some sort of failsafe to detect malformed requests and soft-fail somehow.

How to reproduce it:
Send a POST request as seen below where the JSON after --data is larger than 64KB.

curl -X POST \ 'http://localhost:8080/api/experimental/dags/<DAG_ID>/dag_runs' \ --header 'Cache-Control: no-cache' \ --header 'Content-Type: application/json' \ --data '{"conf":"{\"key\":\"value\"}"}'

Anything else we need to know:
This bug will break the DAG listing (localhost:1188/admin) as well as the UI for the offending DAG (localhost:1188/admin/airflow/tree?dag_id=<my_broken_dag>)

Activity

  1. added
    kind:bug
    on Feb 9, 2021
  2. boring-cyborg commented on Feb 9, 2021

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template!

  3. ashb commented on Feb 10, 2021

    @ashb
    Member

    The post request gave a 200 I assume?

    Are you on MySQL? I suspect what has happened is mysql, in its infinite wisdom, has silently trucated the JSON blob, so now the value in the DB is not valid JSON, but the post data was.

  4. added
    area:API
    on Feb 10, 2021
  5. THEdavehogue commented on Feb 10, 2021

    @THEdavehogue
    Author

    The post request gave a 200 I assume?

    Are you on MySQL? I suspect what has happened is mysql, in its infinite wisdom, has silently trucated the JSON blob, so now the value in the DB is not valid JSON, but the post data was.

    exactly this. 200 response, DAG run created but sql errors due to truncation.

  6. codersky commented on Mar 28, 2021

    @codersky

    as a workaround, we change the conf column from tiny blob to medium in mysql

  7. eladkal commented on Oct 8, 2021

    @eladkal
    Contributor

    This issue is reported against old airflow version. The experimental API is deprecated in favor of a rest API.
    Please upgrade your Airflow version and change to the rest API:
    https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:APIkind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions