in reply to Sharing a database connection across fork()

Expect that each child must establish its own database connection, using credential strings provided (or inherited) by the parent.   A “database handle” is, after all, representative of an internal data-structure which represents not only the connection but the entire context of that connection (current record position, prepared query, and so on), all of which your various threads are attempting to use – along with the parent – with no provision being made to synchronize those activities.   Conflcts, and crashes, are inevitable.

It will also be particularly important that there not be too-many threads, and that they are persistent:   having created their (individual ...) database connection, they should keep it for a long while and do many units of work in succession through it.