cbrain icon indicating copy to clipboard operation
cbrain copied to clipboard

Make sure we call "reset_connection()" on all DPs after a fork

Open prioux opened this issue 7 months ago • 0 comments

When forking processes using spawn_with_active_records() we should make sure to call the method reset_connection() on all online DPs.

The method is NOT defined for all DP types, so maybe do a check with respond_to?() first.

The reason for this is that whatever process starts, say, a BAC worker, might have a pool of connections already in use that would be unusable within the subprocess.

This happens for S3 providers mostly (S3Flat is the only class that has the reset_connection() method) but let's call it on all DPs that support it.

I had a problem of a BAC worker crashing while attempting to access one particular S3 server, because the worker was started from a process that had already done at least one access to that S3 server, so a pool of connection had already been set up before the fork for the BAC worker.

prioux avatar Jun 05 '25 15:06 prioux