On Tuesday, April 16, 2019 at 9:41:39 AM UTC-4, Mike Bayer wrote: > > On Tue, Apr 16, 2019 at 4:49 AM tonthon wrote: > > > > Celery tasks are using the same scoped_session factory, could it cause > the errors we're facing here ? >
Is Celery running as threads or multiprocessing? IIRC, it uses multiprocessing at default and can run into the same connection pool issue if you touch the database during initialization. If so, there is a similar post-fork fix... from celery.signals import worker_process_init @worker_process_init.connect def mycelery_atfork(signal=None, sender=None, **named): db_engine = get_db_engine() db_engine.dispose() -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.