AndrewTsao opened a new issue, #25117:
URL: https://github.com/apache/airflow/issues/25117

   ### Apache Airflow version
   
   2.3.3 (latest released)
   
   ### What happened
   
   ```log
   [2022-07-18 08:55:48,355] {dagbag.py:197} WARNING - Serialized DAG 
call_monitor no longer exists
   [2022-07-18 08:55:48,356] {scheduler_job.py:1106} ERROR - Couldn't find dag 
call_monitor in DagBag/DB!
   [2022-07-18 08:55:48,376] {scheduler_job.py:756} ERROR - Exception when 
executing SchedulerJob._run_scheduler_loop
   Traceback (most recent call last):
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", 
line 739, in _execute
       self._run_scheduler_loop()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", 
line 827, in _run_scheduler_loop
       num_queued_tis = self._do_scheduling(session)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", 
line 912, in _do_scheduling
       guard.commit()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/utils/sqlalchemy.py", 
line 284, in commit
       self.session.commit()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 1423, in commit
       self._transaction.commit(_to_root=self.future)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 829, in commit
       self._prepare_impl()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 808, in _prepare_impl
       self.session.flush()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 3255, in flush
       self._flush(objects)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 3395, in _flush
       transaction.rollback(_capture_exception=True)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py",
 line 70, in __exit__
       compat.raise_(
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", 
line 211, in raise_
       raise exception
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 3355, in _flush
       flush_context.execute()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", 
line 453, in execute
       rec.execute(self)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", 
line 627, in execute
       util.preloaded.orm_persistence.save_obj(
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", 
line 234, in save_obj
       _emit_update_statements(
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", 
line 1032, in _emit_update_statements
       raise orm_exc.StaleDataError(
   sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'dag_run' 
expected to update 11 row(s); 0 were matched.
   [2022-07-18 08:55:49,488] {process_utils.py:125} INFO - Sending 
Signals.SIGTERM to group 3261. PIDs of all processes in the group: [18519, 3261]
   [2022-07-18 08:55:49,488] {process_utils.py:80} INFO - Sending the signal 
Signals.SIGTERM to group 3261
   [2022-07-18 08:55:51,139] {process_utils.py:240} INFO - Waiting up to 5 
seconds for processes to exit...
   [2022-07-18 08:55:51,269] {process_utils.py:75} INFO - Process 
psutil.Process(pid=3261, status='terminated', exitcode=0, started='2022-07-14 
16:23:21') (3261) terminated with exit code 0
   [2022-07-18 08:55:51,271] {process_utils.py:75} INFO - Process 
psutil.Process(pid=18519, status='terminated', started='08:55:49') (18519) 
terminated with exit code None
   [2022-07-18 08:55:51,272] {scheduler_job.py:768} INFO - Exited execute loop
   Traceback (most recent call last):
     File "/home/xxxxx/.local/bin/airflow", line 8, in <module>
       sys.exit(main())
     File "/home/xxxxx/.local/lib/python3.8/site-packages/airflow/__main__.py", 
line 38, in main
       args.func(args)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/cli/cli_parser.py", 
line 51, in command
       return func(*args, **kwargs)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/utils/cli.py", line 99, 
in wrapper
       return f(*args, **kwargs)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/cli/commands/scheduler_command.py",
 line 75, in scheduler
       _run_scheduler_job(args=args)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/cli/commands/scheduler_command.py",
 line 46, in _run_scheduler_job
       job.run()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/jobs/base_job.py", line 
244, in run
       self._execute()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", 
line 739, in _execute
       self._run_scheduler_loop()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", 
line 827, in _run_scheduler_loop
       num_queued_tis = self._do_scheduling(session)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/jobs/scheduler_job.py", 
line 912, in _do_scheduling
       guard.commit()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/airflow/utils/sqlalchemy.py", 
line 284, in commit
       self.session.commit()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 1423, in commit
       self._transaction.commit(_to_root=self.future)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 829, in commit
       self._prepare_impl()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 808, in _prepare_impl
       self.session.flush()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 3255, in flush
       self._flush(objects)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 3395, in _flush
       transaction.rollback(_capture_exception=True)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py",
 line 70, in __exit__
       compat.raise_(
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", 
line 211, in raise_
       raise exception
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", 
line 3355, in _flush
       flush_context.execute()
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", 
line 453, in execute
       rec.execute(self)
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", 
line 627, in execute
       util.preloaded.orm_persistence.save_obj(
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", 
line 234, in save_obj
       _emit_update_statements(
     File 
"/home/xxxxx/.local/lib/python3.8/site-packages/sqlalchemy/orm/persistence.py", 
line 1032, in _emit_update_statements
       raise orm_exc.StaleDataError(
   sqlalchemy.orm.exc.StaleDataError: UPDATE statement on table 'dag_run' 
expected to update 11 row(s); 0 were matched.
   ```
   
   ### What you think should happen instead
   
   Scheduler can't crash by DAGs's operation like delete a DAG.
   
   ### How to reproduce
   
   1 change a DAG dag_id in the DAG script.
   2 delete old DAG on UI.
   
   ### Operating System
   
   CentOS Linux release 7.9.2009 (Core)
   
   ### Versions of Apache Airflow Providers
   
   ```
   apache-airflow==2.3.3
   airflow-code-editor==5.2.2
   apache-airflow-providers-celery==3.0.0
   apache-airflow-providers-microsoft-psrp==2.0.0
   apache-airflow-providers-microsoft-winrm==3.0.0
   apache-airflow-providers-mysql==3.0.0
   apache-airflow-providers-redis==3.0.0
   apache-airflow-providers-samba==4.0.0
   apache-airflow-providers-sftp==3.0.0
   brotlipy==0.7.0
   chardet==3.0.4
   pip-chill==1.0.1
   pyopenssl==19.1.0
   pysocks==1.7.1
   python-ldap==3.4.2
   requests-credssp==2.0.0
   swagger-ui-bundle==0.0.9
   tqdm==4.51.0
   ```
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   Once.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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