potiuk opened a new issue #11787:
URL: https://github.com/apache/airflow/issues/11787


   **Environment**:
   
   Breeze Sqlite version
   
   
   **What happened**:
   
   With the current master version of Airflow there is a problem with locking 
the database when running default Airflow configuration in Sqlite in Breeze.
   
   ## How to reproduce
   
   
   ```./breeze start-airflow --load-example-dags```
   
   Start running/clicking on DAGS, You will soon start getting errors: 
   
   
   ```
   he above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2447, in 
wsgi_app
       response = self.full_dispatch_request()
     File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1952, in 
full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1821, in 
handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, 
in reraise
       raise value
     File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1950, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1936, in 
dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File "/opt/airflow/airflow/www/decorators.py", line 117, in wrapper
       return f(self, *args, **kwargs)
     File 
"/usr/local/lib/python3.6/site-packages/flask_appbuilder/security/decorators.py",
 line 109, in wraps
       return f(self, *args, **kwargs)
     File "/opt/airflow/airflow/www/decorators.py", line 98, in view_func
       return f(*args, **kwargs)
     File "/opt/airflow/airflow/www/decorators.py", line 59, in wrapper
       session.add(log)
     File "/usr/local/lib/python3.6/contextlib.py", line 88, in __exit__
       next(self.gen)
     File "/opt/airflow/airflow/utils/session.py", line 31, in create_session
       session.commit()
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", 
line 1042, in commit
       self.transaction.commit()
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", 
line 504, in commit
       self._prepare_impl()
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", 
line 483, in _prepare_impl
       self.session.flush()
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", 
line 2523, in flush
       self._flush(objects)
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", 
line 2664, in _flush
       transaction.rollback(_capture_exception=True)
     File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 
69, in __exit__
       exc_value, with_traceback=exc_tb,
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", 
line 182, in raise_
       raise exception
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/session.py", 
line 2624, in _flush
       flush_context.execute()
     File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 
422, in execute
       rec.execute(self)
     File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/unitofwork.py", line 
589, in execute
       uow,
     File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 
245, in save_obj
       insert,
     File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/persistence.py", line 
1136, in _emit_insert_statements
       statement, params
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", 
line 1011, in execute
       return meth(self, multiparams, params)
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", 
line 298, in _execute_on_connection
       return connection._execute_clauseelement(self, multiparams, params)
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", 
line 1130, in _execute_clauseelement
       distilled_params,
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", 
line 1317, in _execute_context
       e, statement, parameters, cursor, context
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", 
line 1511, in _handle_dbapi_exception
       sqlalchemy_exception, with_traceback=exc_info[2], from_=e
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", 
line 182, in raise_
       raise exception
     File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", 
line 1277, in _execute_context
       cursor, statement, parameters, context
     File 
"/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 
593, in do_execute
       cursor.execute(statement, parameters)
   sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is 
locked
   [SQL: INSERT INTO log (dttm, dag_id, task_id, event, execution_date, owner, 
extra) VALUES (?, ?, ?, ?, ?, ?, ?)]
   [parameters: ('2020-10-23 16:35:08.015990', 'example_branch_operator', None, 
'tree', None, 'admin', "[('dag_id', 'example_branch_operator')]")]              
                                                                                
                                          
   (Background on this error at: http://sqlalche.me/e/13/e3q8)
   ```
   
   
   
   
   **Anything else we need to know**:
   
   <!--
   
   How often does this problem occur? Once? Every time etc?
   
   Any relevant logs to include? Put them here in side a detail tag:
   <details><summary>x.log</summary> lots of stuff </details>
   
   -->
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to