airflow: airflow throws error: airflow.exceptions.SerializedDagNotFound: DAG 'dns-basic-1min' not found in serialized_dag table

hi,team:

i deployment airflow 2.0.2 in docker by docker-compose,airflow service start just 1 minute have many dags,bug 1 minute after dag is none,and throws bellow error:

already share dag folder to webservice/scheduler/flower container

image image

Python version: 3.8.5
Airflow version: 2.0.2
Node: airflow-webserver
-------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/root/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/airflow/www/auth.py", line 34, in decorated
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/airflow/www/decorators.py", line 97, in view_func
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/airflow/www/decorators.py", line 60, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/airflow/www/views.py", line 1876, in tree
    dag = current_app.dag_bag.get_dag(dag_id)
  File "/usr/local/lib/python3.8/site-packages/airflow/utils/session.py", line 70, in wrapper
    return func(*args, session=session, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/airflow/models/dagbag.py", line 181, in get_dag
    self._add_dag_from_db(dag_id=dag_id, session=session)
  File "/usr/local/lib/python3.8/site-packages/airflow/models/dagbag.py", line 237, in _add_dag_from_db
    raise SerializedDagNotFound(f"DAG '{dag_id}' not found in serialized_dag table")
airflow.exceptions.SerializedDagNotFound: DAG 'dns-basic-1min' not found in serialized_dag table

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (10 by maintainers)

Most upvoted comments

In a broader sense, it seems to me that when an error of “X not found” happens in most applications then no exception is generated, merely an error message stating that “X was not found”.

Absolutely agree, it this is “expected” error. I.e. if there is an action from a user or known reason/flow that leads to it, you can - and should - provide a description and remediation,

Conversely, if something is the result of some totally unexpected condition which is likely a bug in the software or bug in migration process that was not possible to handle - it is virtually impossible to predict that it can happen. The statement that “all errors “SHOULD” be handled without generating an exception” takes the simplistic point of view that every single flow in the program is checked an handled and software is bug free. Which is not only not reasonable expectation it is also virtually impossible to prove from the software engineering point of view.

@kaxil

I found the issue!

It turns out that I had a minimized window open with the http://localhost:8080/graph?dag_id=tutorial in it! This was from doing the tutorial walkthru days prior with some other folks.

Now that I have closed that window the Airflow webserver exception no longer occurs (as shown in the screenshot above).

I guess that the minimized window was reconnecting to airflow and attempting to get info on the tutorial dag that it assumed was still serialized – causing the airflow webserver to crash with the SerializedDagNotFound message.