raphaelauv opened a new issue #18936:
URL: https://github.com/apache/airflow/issues/18936


   ### Apache Airflow version
   
   2.1.2
   
   ### Operating System
   
   GCP Container-Optimized OS
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-cncf-kubernetes==2.0.2 
   apache-airflow-providers-slack[http]==4.1.0
   
   ### Deployment
   
   Composer
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   I Had 2 dags file with same dag name , just after deleted 1 of them and 
doing a F5 on the dag ui of the webserver it crash with : 
   
   ```log
   Something bad has happened.
   Please consider letting us know by creating a bug report using GitHub.
   
   Python version: 3.8.12
   Airflow version: 2.1.2+composer
   Node: airflow-webserver-XXXXXXXX
   
-------------------------------------------------------------------------------
   Traceback (most recent call last):
     File "/opt/python3.8/lib/python3.8/site-packages/flask/app.py", line 2447, 
in wsgi_app
       response = self.full_dispatch_request()
     File "/opt/python3.8/lib/python3.8/site-packages/flask/app.py", line 1952, 
in full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/opt/python3.8/lib/python3.8/site-packages/flask/app.py", line 1821, 
in handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/opt/python3.8/lib/python3.8/site-packages/flask/_compat.py", line 
39, in reraise
       raise value
     File "/opt/python3.8/lib/python3.8/site-packages/flask/app.py", line 1950, 
in full_dispatch_request
       rv = self.dispatch_request()
     File "/opt/python3.8/lib/python3.8/site-packages/flask/app.py", line 1936, 
in dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File "/opt/python3.8/lib/python3.8/site-packages/airflow/www/auth.py", 
line 34, in decorated
       return func(*args, **kwargs)
     File 
"/opt/python3.8/lib/python3.8/site-packages/airflow/utils/session.py", line 70, 
in wrapper
       return func(*args, session=session, **kwargs)
     File "/opt/python3.8/lib/python3.8/site-packages/airflow/www/views.py", 
line 888, in code
       return self.render_template(
     File "/opt/python3.8/lib/python3.8/site-packages/airflow/www/views.py", 
line 438, in render_template
       return super().render_template(
     File 
"/opt/python3.8/lib/python3.8/site-packages/flask_appbuilder/baseviews.py", 
line 287, in render_template
       return render_template(
     File "/opt/python3.8/lib/python3.8/site-packages/flask/templating.py", 
line 137, in render_template
       return _render(
     File "/opt/python3.8/lib/python3.8/site-packages/flask/templating.py", 
line 119, in _render
       before_render_template.send(app, template=template, context=context)
     File "/opt/python3.8/lib/python3.8/site-packages/blinker/base.py", line 
266, in send
       return [(receiver, receiver(sender, **kwargs))
     File "/opt/python3.8/lib/python3.8/site-packages/blinker/base.py", line 
266, in <listcomp>
       return [(receiver, receiver(sender, **kwargs))
     File "/opt/python3.8/lib/python3.8/site-packages/airflow/www/views.py", 
line 455, in add_user_permissions_to_dag
       can_create_dag_run = current_app.appbuilder.sm.has_access(
     File "/opt/python3.8/lib/python3.8/site-packages/airflow/www/security.py", 
line 403, in has_access
       has_access = self._has_view_access(user, permission, resource)
     File 
"/opt/python3.8/lib/python3.8/site-packages/flask_appbuilder/security/manager.py",
 line 1389, in _has_view_access
       roles = user.roles
     File "/opt/python3.8/lib/python3.8/site-packages/werkzeug/local.py", line 
347, in __getattr__
       return getattr(self._get_current_object(), name)
     File 
"/opt/python3.8/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 
294, in __get__
       return self.impl.get(instance_state(instance), dict_)
     File 
"/opt/python3.8/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 
730, in get
       value = self.callable_(state, passive)
     File 
"/opt/python3.8/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 
717, in _load_for_state
       raise orm_exc.DetachedInstanceError(
   sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <User at 
0x7f8cfafbec40> is not bound to a Session; lazy load operation of attribute 
'roles' cannot proceed (Background on this error at: 
http://sqlalche.me/e/13/bhk3)
   ```
   
   ### What you expected to happen
   
   I'm not sure if that bug is really critical
   
   ### How to reproduce
   
   2 dags with same name in 2 two different file name
   
   open the webserver ui on the dag
   
   delete 1 file from the scheduler
   
   F5 on the webserver ui page of the dag
   
   ### Anything else
   
   _No response_
   
   ### 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