-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IntegrityError during webserver startup #27297
Fix IntegrityError during webserver startup #27297
Conversation
When starting up the webserver, we create all the `gunicorn` workers needed and each of these workers creates the webserver app instead of getting a copy of the app. This results in all the workers trying to write to the database at the same time causing a lot of IntegrityError in the database. The fix was to preload the app before forking workers
No issues with plugins any more ? |
Yes. What is loaded at that point is web UI plugin. The airflow/airflow/www/extensions/init_views.py Lines 123 to 147 in 126b7b8
The Lines 86 to 89 in 126b7b8
|
Cool! |
just tested, this works! |
(cherry picked from commit 8f99c79)
(cherry picked from commit 8f99c79)
@ephraimbuddy Thanks for this! Will this also help where there are multiple webservers being started on different instances? We originally mitigated this issue by slowing scaling up the workers on each instance as described here. That worked fine for when there was only one webserver instance, but not when there were multiple. With this fix, when two webservers both start up and attempt the preload, is there a chance they will hit the same issue? |
When starting up the webserver, we create all the
gunicorn
workers needed and each of these workers creates the webserver app instead of getting a copy of the app. This results in all the workers trying to write to the database at the same time causing a lot of IntegrityError in the database.The fix was to preload the app before forking workers
closes: #23512