robdiciuccio opened a new pull request #13350: URL: https://github.com/apache/superset/pull/13350
### SUMMARY Adds a listener for the `worker_process_init` Celery [signal](https://docs.celeryproject.org/en/4.4.2/userguide/signals.html#worker-process-init) that disposes of and resets the SQLAlchemy connection pool being passed to the forked process. Resolves the intermittent `sqlalchemy.exc.NoSuchColumnError` reported in #10530 and #12766. This fix is primarily related to the default `prefork` Celery execution pool, but was also tested with the following pool invocations: ``` celery worker --app=superset.tasks.celery_app:app -Ofair -l INFO ``` ``` celery worker --app=superset.tasks.celery_app:app --pool=threads -c 12 -l INFO ``` ``` celery worker --app=superset.tasks.celery_app:app --pool=gevent -c 12 -l INFO ``` This configuration was tested with [async queries](https://github.com/apache/superset/pull/11499) enabled to place load on the celery workers, in both standalone and Docker-based workflows. This PR also includes a fix for a client-side race condition in loading charts asynchronously. References: https://docs.sqlalchemy.org/en/13/core/connections.html#engine-disposal https://www.yangster.ca/post/not-the-same-pre-fork-worker-model/ ### TEST PLAN Asynchronous tasks should run without `sqlalchemy.exc.NoSuchColumnError` when celery is run in `prefork` mode. See #10530 and #12766 for reproducability. ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: Fixes #10530 and #12766 - [ ] Changes UI - [ ] Requires DB Migration. - [ ] Confirm DB Migration upgrade and downgrade tested. - [ ] Introduces new feature or API - [ ] Removes existing feature or API ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
