bravado icon indicating copy to clipboard operation
bravado copied to clipboard

Asynchronous client is not fork-safe

Open prat0318 opened this issue 9 years ago • 3 comments

Client hangs if it is created and cached in the pre-fork phase of running of uwsgi. This only happens for Asynchronous client which uses twisted underneath. As per @bpicolo : "The twisted clients aren't fork safe because they open FDs, and won't ever be unless you all-in on twisted for your stack. Twisted has it's own way of forking."

prat0318 avatar Oct 16 '15 19:10 prat0318

A "valid solution" should be to fork before importing bravado.

bpicolo avatar Oct 20 '15 04:10 bpicolo

But i think the intent is to have the bravado client creation pre-fork and cache it. How will that be achieved if importing bravado happens later.

prat0318 avatar Oct 20 '15 04:10 prat0318

Delaying import until post-fork is kinda fragile. It'd be nice if there were a reset() that can be invoked post-fork to clean up any file descriptors.

bchess avatar Jun 28 '16 22:06 bchess