ANN: Sarge, a library wrapping the subprocess module, has been released.

Vinay Sajip vinay_sajip at
Sun Feb 12 21:21:55 CET 2012

On Feb 12, 4:19 pm, Anh Hai Trinh < at> wrote:

> If you use threads and call fork(), you'll almost guaranteed to face with deadlocks. Perhaps not in a particular piece of code, but some others. Perhaps not on your laptop, but on the production machine with different kernels. Like most race conditions, they will eventually show up.

You can hit deadlocks in multi-threaded programs even without the
fork(), can't you? In that situation, you either pin it down to a bug
in your code (and even developers experienced in writing multi-
threaded programs hit these), or a bug in the underlying library
(which can hopefully be fixed, but that applies to any bug you might
hit in any library you use, and is something you have to consider
whenever you use a library written by someone else), or an unfixable
problem (e.g. due to problems in the Python or C runtime) which
require a different approach. I understand your concerns, but you are
just a little further along the line from people who say "If you use
threads, you will have deadlock problems. Don't use threads." I'm not
knocking that POV - people need to use what they're comfortable with,
and to avoid things that make them uncomfortable. I'm not pushing the
async feature as a major advantage of the library - it's still useful
without that, IMO.


Vinay Sajip

More information about the Python-list mailing list