Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

win-nt from the people who invented edlin. -- MaDsen Wikholm, mwikholm@at8.abo.fi


devel / comp.lang.python / threading and multiprocessing deadlock

SubjectAuthor
* threading and multiprocessing deadlockJohannes Bauer
+* Re: threading and multiprocessing deadlockMartin Di Paola
|`- Re: threading and multiprocessing deadlockJohannes Bauer
+- Re: threading and multiprocessing deadlockBarry Scott
`- Re: threading and multiprocessing deadlockDieter Maurer

1
threading and multiprocessing deadlock

<sojj7k$1ek1$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16307&group=comp.lang.python#16307

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!y54SatD1QB/v/YCGY14Zmg.user.46.165.242.75.POSTED!not-for-mail
From: dfnsonfs...@gmx.de (Johannes Bauer)
Newsgroups: comp.lang.python
Subject: threading and multiprocessing deadlock
Date: Mon, 6 Dec 2021 00:50:11 +0100
Organization: Aioe.org NNTP Server
Message-ID: <sojj7k$1ek1$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="47745"; posting-host="y54SatD1QB/v/YCGY14Zmg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Content-Language: en-US
X-Mozilla-News-Host: news://nntp.aioe.org:119
X-Notice: Filtered by postfilter v. 0.9.2
 by: Johannes Bauer - Sun, 5 Dec 2021 23:50 UTC

Hi there,

I'm a bit confused. In my scenario I a mixing threading with
multiprocessing. Threading by itself would be nice, but for GIL reasons
I need both, unfortunately. I've encountered a weird situation in which
multiprocessing Process()es which are started in a new thread don't
actually start and so they deadlock on join.

I've created a minimal example that demonstrates the issue. I'm running
on x86_64 Linux using Python 3.9.5 (default, May 11 2021, 08:20:37)
([GCC 10.3.0] on linux).

Here's the code:

import time
import multiprocessing
import threading

def myfnc():
print("myfnc")

def run(result_queue, callback):
result = callback()
result_queue.put(result)

def start(fnc):
def background_thread():
queue = multiprocessing.Queue()
proc = multiprocessing.Process(target = run, args = (queue, fnc))
proc.start()
print("join?")
proc.join()
print("joined.")
result = queue.get()
threading.Thread(target = background_thread).start()

start(myfnc)
start(myfnc)
start(myfnc)
start(myfnc)
while True:
time.sleep(1)

What you'll see is that "join?" and "joined." nondeterministically does
*not* appear in pairs. For example:

join?
join?
myfnc
myfnc
join?
join?
joined.
joined.

What's worse is that when this happens and I Ctrl-C out of Python, the
started Thread is still running in the background:

$ ps ax | grep minimal
370167 pts/0 S 0:00 python3 minimal.py
370175 pts/2 S+ 0:00 grep minimal

Can someone figure out what is going on there?

Best,
Johannes

Re: threading and multiprocessing deadlock

<mailman.19.1638795411.15287.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16313&group=comp.lang.python#16313

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: martinp....@gmail.com (Martin Di Paola)
Newsgroups: comp.lang.python
Subject: Re: threading and multiprocessing deadlock
Date: Mon, 6 Dec 2021 12:56:43 +0000
Lines: 132
Message-ID: <mailman.19.1638795411.15287.python-list@python.org>
References: <sojj7k$1ek1$1@gioia.aioe.org>
<20211206125643.7g55nf4a45naji7u@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de SYSGssJGKwEa/SxteVr42AFuzXBpB6jZk0h8WP+tT69w==
Return-Path: <martinp.dipaola@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=e4fS7Mq5;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'issue.':
0.05; 'parallel': 0.05; 'thread': 0.05; 'joining': 0.07; 'queue':
0.07; 'example:': 0.09; 'grep': 0.09; 'join.': 0.09; 'linux':
0.09; 'threads': 0.09; 'url:mailman': 0.15; 'problem.': 0.15;
'confused.': 0.16; 'demonstrates': 0.16; 'gil': 0.16; 'proc':
0.16; 'python3': 0.16; 'run,': 0.16; 'skip:> 10': 0.16;
'subject:skip:m 10': 0.16; 'threading': 0.16; 'wrote:': 0.16;
'problem': 0.16; 'python': 0.16; 'probably': 0.17; 'message-
id:@gmail.com': 0.18; 'calls': 0.19; 'figure': 0.19; 'to:addr
:python-list': 0.20; 'issue': 0.21; "i've": 0.22; 'ran': 0.22;
'code': 0.23; '(and': 0.25; 'url-ip:188.166.95.178/32': 0.25;
'url-ip:188.166.95/24': 0.25; 'python,': 0.25; 'url:listinfo':
0.25; 'url-ip:188.166/16': 0.25; 'bit': 0.27; 'function': 0.27;
'output': 0.28; 'dec': 0.31; 'url-ip:188/8': 0.31; 'program':
0.31; 'think': 0.32; 'encountered': 0.32; 'but': 0.32; "i'm":
0.33; 'someone': 0.34; 'same': 0.34; 'work.': 0.34; 'header:In-
Reply-To:1': 0.34; 'received:google.com': 0.34; 'running': 0.34;
'from:addr:gmail.com': 0.35; 'fix': 0.36; 'functions': 0.36;
'mon,': 0.36; 'thanks,': 0.36; 'guide': 0.37; 'using': 0.37;
'received:209.85': 0.37; 'could': 0.38; 'received:209': 0.39;
'least': 0.39; 'received:209.85.222': 0.39; 'still': 0.40;
'situation': 0.40; 'should': 0.40; 'reasonable': 0.62; 'skip:b
20': 0.63; 'skip:m 20': 0.63; 'skip:b 10': 0.63; 'skip:r 20':
0.64; 'your': 0.64; 'skip:t 20': 0.66; 'receiving': 0.66; 'now,':
0.67; 'order': 0.69; 'within': 0.69; '2021': 0.71; "you'll": 0.73;
'happens': 0.84; 'reasons': 0.84; 'martin.': 0.84; 'narrow': 0.84;
'true:': 0.84; 'weird': 0.84; 'preserved': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=date:from:to:subject:message-id:mail-followup-to:'user-agent
:references:mime-version:content-disposition:in-reply-to;
bh=PzqNReKPgmSelAG1asQOVurT6F31+ubLV3YSH1Tt6es=;
b=e4fS7Mq5HtAV3RL/zwZyKK7tK9ltk77iIvjQAKi1kf+Z1Y0td4rfgWVvt73FUEi1Lh
x0d6Q/bAMMswXoKBrqPjmMoCulduwDXy8Vg3ETIaQHhZsqPlk87v2fs5vkf47SPn0hEc
69Aq79bVE7Nj6eIFNnh0IHfEb9I7bAbsJZIJ38xohh+SRQIyl/TREI9Tx6/YRwK6Fvws
h32AuUyZ7mzJ4t5zzG5zt3BBQODVelysV0rAi0AN8HiJpG7Z6tViH9mq4o2YluB+u+WJ
Yg2SJqTS1webPgcEOITAWvgSSvfgSkgPdA0CE35PZgc7TUFZS1MOX5tv3yrtGFA3YvHq
PERg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to
:'user-agent:references:mime-version:content-disposition:in-reply-to;
bh=PzqNReKPgmSelAG1asQOVurT6F31+ubLV3YSH1Tt6es=;
b=54ximt7rhiIFEEjp2RLxHX820xx9l3KyDVmudVjqeHQh0ZSMqp1EjhcsAk1dO/jKnx
Ip55/JEk5NzV49vJfwd8K7gNdtuRMngpDlVyaAaBzevC2blmypEQDekdniz6W46mP1fJ
K5rCG2GKHDQLXHtwgzZ9pY+TrusGzkGQICUYBB8LQiKiepRZNS6wZnXYtcRGqT5vHm7J
y9FZg/w9K+iEW6NFjQSI/avb3W4JoKfae1twu+Z8i0L3BmU6Pq9J6srczxyMP/0nr95n
s+WHC3dgx3Hxng6maEEZFB3nezu15SKPjcMyuZA5YkRbozE/G4AEpEgOUMLhX4TOF+Pi
krmA==
X-Gm-Message-State: AOAM532p22k0Yq0fTlyZmkX+xF9XIVuQGwqlHIp8BajqqUwaTmaK8VdD
uE54RYhIfp14tIv9eruGcLzvMqnH8YxiEA==
X-Google-Smtp-Source: ABdhPJxizJJy2Bhrguxs5qs09yI3ENU4RwZMIoQhlC8oAyWCmVnDPv6TAE33soxNiQp73OukfvCczA==
X-Received: by 2002:a05:6102:a50:: with SMTP id
i16mr35315792vss.72.1638795406532;
Mon, 06 Dec 2021 04:56:46 -0800 (PST)
Mail-Followup-To: python-list@python.org
'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2 Lightning/5.4.5.2'
Content-Disposition: inline
In-Reply-To: <sojj7k$1ek1$1@gioia.aioe.org>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.38
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20211206125643.7g55nf4a45naji7u@gmail.com>
X-Mailman-Original-References: <sojj7k$1ek1$1@gioia.aioe.org>
 by: Martin Di Paola - Mon, 6 Dec 2021 12:56 UTC

Hi!, in short your code should work.

I think that the join-joined problem is just an interpretation problem.

In pseudo code the background_thread function does:

def background_thread()
# bla
print("join?")
# bla
print("joined")

When running this function in parallel using threads, you will probably
get a few "join?" first before receiving any "joined?". That is because
the functions are running in parallel.

The order "join?" then "joined" is preserved within a thread but not
preserved globally.

Now, I see another issue in the output (and perhaps you was asking about
this one):

join?
join?
myfnc
myfnc
join?
join?
joined.
joined.

So you have 4 "join?" that correspond to the 4 background_thread
function calls in threads but only 2 "myfnc" and 2 "joined".

Could be possible that the output is truncated by accident?

I ran the same program and I got a reasonable output (4 "join?", "myfnc"
and "joined"):

join?
join?
myfnc
join?
myfnc
join?
joined.
myfnc
joined.
joined.
myfnc
joined.

Another issue that I see is that you are not joining the threads that
you spawned (background_thread functions).

I hope that this can guide you to fix or at least narrow the issue.

Thanks,
Martin.

On Mon, Dec 06, 2021 at 12:50:11AM +0100, Johannes Bauer wrote:
>Hi there,
>
>I'm a bit confused. In my scenario I a mixing threading with
>multiprocessing. Threading by itself would be nice, but for GIL reasons
>I need both, unfortunately. I've encountered a weird situation in which
>multiprocessing Process()es which are started in a new thread don't
>actually start and so they deadlock on join.
>
>I've created a minimal example that demonstrates the issue. I'm running
>on x86_64 Linux using Python 3.9.5 (default, May 11 2021, 08:20:37)
>([GCC 10.3.0] on linux).
>
>Here's the code:
>
>
>import time
>import multiprocessing
>import threading
>
>def myfnc():
> print("myfnc")
>
>def run(result_queue, callback):
> result = callback()
> result_queue.put(result)
>
>def start(fnc):
> def background_thread():
> queue = multiprocessing.Queue()
> proc = multiprocessing.Process(target = run, args = (queue, fnc))
> proc.start()
> print("join?")
> proc.join()
> print("joined.")
> result = queue.get()
> threading.Thread(target = background_thread).start()
>
>start(myfnc)
>start(myfnc)
>start(myfnc)
>start(myfnc)
>while True:
> time.sleep(1)
>
>
>What you'll see is that "join?" and "joined." nondeterministically does
>*not* appear in pairs. For example:
>
>join?
>join?
>myfnc
>myfnc
>join?
>join?
>joined.
>joined.
>
>What's worse is that when this happens and I Ctrl-C out of Python, the
>started Thread is still running in the background:
>
>$ ps ax | grep minimal
> 370167 pts/0 S 0:00 python3 minimal.py
> 370175 pts/2 S+ 0:00 grep minimal
>
>Can someone figure out what is going on there?
>
>Best,
>Johannes
>--
>https://mail.python.org/mailman/listinfo/python-list

Re: threading and multiprocessing deadlock

<sol8rd$arj$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16314&group=comp.lang.python#16314

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!y54SatD1QB/v/YCGY14Zmg.user.46.165.242.75.POSTED!not-for-mail
From: dfnsonfs...@gmx.de (Johannes Bauer)
Newsgroups: comp.lang.python
Subject: Re: threading and multiprocessing deadlock
Date: Mon, 6 Dec 2021 16:05:17 +0100
Organization: Aioe.org NNTP Server
Message-ID: <sol8rd$arj$1@gioia.aioe.org>
References: <sojj7k$1ek1$1@gioia.aioe.org>
<20211206125643.7g55nf4a45naji7u@gmail.com>
<mailman.19.1638795411.15287.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="11123"; posting-host="y54SatD1QB/v/YCGY14Zmg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Johannes Bauer - Mon, 6 Dec 2021 15:05 UTC

Am 06.12.21 um 13:56 schrieb Martin Di Paola:
> Hi!, in short your code should work.
>
> I think that the join-joined problem is just an interpretation problem.
>
> In pseudo code the background_thread function does:
>
> def background_thread()
>   # bla
>   print("join?")
>   # bla
>   print("joined")
>
> When running this function in parallel using threads, you will probably
> get a few "join?" first before receiving any "joined?". That is because
> the functions are running in parallel.
>
> The order "join?" then "joined" is preserved within a thread but not
> preserved globally.

Yes, completely understood and really not the issue. That these pairs
are not in sequence is fine.

> Now, I see another issue in the output (and perhaps you was asking about
> this one):
>
> join?
> join?
> myfnc
> myfnc
> join?
> join?
> joined.
> joined.
>
> So you have 4 "join?" that correspond to the 4 background_thread
> function calls in threads but only 2 "myfnc" and 2 "joined".

Exactly that is the issue. Then it hangs. Deadlocked.

> Could be possible that the output is truncated by accident?

No. This is it. The exact output varies, but when it hangs, it always
also does not execute the function (note the lack of "myfnc"). For example:

join?
join?
myfnc
join?
myfnc
join?
myfnc
joined.
joined.
joined.

(only three threads get started there)

join?
myfnc
join?
join?
join?
joined.

(this time only a single one made it)

join?
join?
join?
myfnc
join?
myfnc
joined.
myfnc
joined.
joined.

(three get started)

> I ran the same program and I got a reasonable output (4 "join?", "myfnc"
> and "joined"):
>
> join?
> join?
> myfnc
> join?
> myfnc
> join?
> joined.
> myfnc
> joined.
> joined.
> myfnc
> joined.

This happens to me occasionally, but most of the time one of the
processes deadlocks. Did you consistently get four of each? What
OS/Python version were you using?

> Another issue that I see is that you are not joining the threads that
> you spawned (background_thread functions).

True, I kindof assumed those would be detached threads.

> I hope that this can guide you to fix or at least narrow the issue.

Depending on what OS/Python version you're using, that points in that
direction and kindof reinforces my belief that the code is correct.

Very curious.

Thanks & all the best,
Joe

Re: threading and multiprocessing deadlock

<mailman.23.1638816103.15287.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16318&group=comp.lang.python#16318

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry Scott)
Newsgroups: comp.lang.python
Subject: Re: threading and multiprocessing deadlock
Date: Mon, 6 Dec 2021 18:41:35 +0000
Lines: 82
Message-ID: <mailman.23.1638816103.15287.python-list@python.org>
References: <sojj7k$1ek1$1@gioia.aioe.org>
<F929683A-61BE-4B5D-B475-422B474E34A6@barrys-emacs.org>
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
Content-Type: text/plain;
charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de e1mN3Uai3AeWbw2qQpPvtQovNW1WUZDeoOsAsgQm4YZQ==
Return-Path: <barry@barrys-emacs.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'issue.':
0.05; 'thread': 0.05; 'queue': 0.07; '*not*': 0.09; 'cc:addr
:python-list': 0.09; 'example:': 0.09; 'from:addr:barry': 0.09;
'grep': 0.09; 'join.': 0.09; 'linux': 0.09; 'messages.': 0.09;
'received:217.70': 0.09; 'received:gandi.net': 0.09;
'received:mail.gandi.net': 0.09; 'cc:no real name:2**0': 0.14;
'import': 0.15; 'url:mailman': 0.15; 'barry': 0.16; 'confused.':
0.16; 'demonstrates': 0.16; 'from:addr:barrys-emacs.org': 0.16;
'from:name:barry scott': 0.16; 'gil': 0.16; 'message-id:@barrys-
emacs.org': 0.16; 'proc': 0.16; 'python3': 0.16; 'run,': 0.16;
'subject:skip:m 10': 0.16; 'threading': 0.16; 'x-mailer:apple mail
(2.3654.120.0.1.13)': 0.16; 'wrote:': 0.16; 'python': 0.16;
'figure': 0.19; 'cc:addr:python.org': 0.20; "i've": 0.22;
"what's": 0.22; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'python,': 0.25; 'saying': 0.25;
'url:listinfo': 0.25; 'cc:2**0': 0.25; 'url-ip:188.166/16': 0.25;
'bit': 0.27; 'suggest': 0.28; 'dec': 0.31; 'url-ip:188/8': 0.31;
'encountered': 0.32; 'but': 0.32; "i'm": 0.33; 'someone': 0.34;
'header:In-Reply-To:1': 0.34; 'running': 0.34; 'using': 0.37;
'best,': 0.38; 'still': 0.40; 'situation': 0.40; 'skip:b 20':
0.63; 'skip:m 20': 0.63; 'skip:r 20': 0.64; 'your': 0.64; 'skip:t
20': 0.66; 'received:217': 0.67; "you'll": 0.73; 'happens': 0.84;
'reasons': 0.84; 'true:': 0.84; 'weird': 0.84
In-Reply-To: <sojj7k$1ek1$1@gioia.aioe.org>
X-Mailer: Apple Mail (2.3654.120.0.1.13)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.38
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <F929683A-61BE-4B5D-B475-422B474E34A6@barrys-emacs.org>
X-Mailman-Original-References: <sojj7k$1ek1$1@gioia.aioe.org>
 by: Barry Scott - Mon, 6 Dec 2021 18:41 UTC

> On 5 Dec 2021, at 23:50, Johannes Bauer <dfnsonfsduifb@gmx.de> wrote:
>
> Hi there,
>
> I'm a bit confused. In my scenario I a mixing threading with
> multiprocessing. Threading by itself would be nice, but for GIL reasons
> I need both, unfortunately. I've encountered a weird situation in which
> multiprocessing Process()es which are started in a new thread don't
> actually start and so they deadlock on join.
>
> I've created a minimal example that demonstrates the issue. I'm running
> on x86_64 Linux using Python 3.9.5 (default, May 11 2021, 08:20:37)
> ([GCC 10.3.0] on linux).
>
> Here's the code:

I suggest that you include the threading.current_thread() in your messages.
Then you can see which thread is saying what.

Barry

>
>
> import time
> import multiprocessing
> import threading
>
> def myfnc():
> print("myfnc")
>
> def run(result_queue, callback):
> result = callback()
> result_queue.put(result)
>
> def start(fnc):
> def background_thread():
> queue = multiprocessing.Queue()
> proc = multiprocessing.Process(target = run, args = (queue, fnc))
> proc.start()
> print("join?")
> proc.join()
> print("joined.")
> result = queue.get()
> threading.Thread(target = background_thread).start()
>
> start(myfnc)
> start(myfnc)
> start(myfnc)
> start(myfnc)
> while True:
> time.sleep(1)
>
>
> What you'll see is that "join?" and "joined." nondeterministically does
> *not* appear in pairs. For example:
>
> join?
> join?
> myfnc
> myfnc
> join?
> join?
> joined.
> joined.
>
> What's worse is that when this happens and I Ctrl-C out of Python, the
> started Thread is still running in the background:
>
> $ ps ax | grep minimal
> 370167 pts/0 S 0:00 python3 minimal.py
> 370175 pts/2 S+ 0:00 grep minimal
>
> Can someone figure out what is going on there?
>
> Best,
> Johannes
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Re: threading and multiprocessing deadlock

<mailman.24.1638816848.15287.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16319&group=comp.lang.python#16319

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: die...@handshake.de (Dieter Maurer)
Newsgroups: comp.lang.python
Subject: Re: threading and multiprocessing deadlock
Date: Mon, 6 Dec 2021 19:38:08 +0100
Lines: 14
Message-ID: <mailman.24.1638816848.15287.python-list@python.org>
References: <sojj7k$1ek1$1@gioia.aioe.org>
<25006.22672.283410.422526@ixdm.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de Zl2S9nJPhjFXGMTpKQv1ZQBLS8yx1r57NbMDGjKzlI+w==
Return-Path: <dieter@handshake.de>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.025
X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'thread': 0.05; 'cc:addr
:python-list': 0.09; 'join.': 0.09; 'skip:` 10': 0.09; 'cc:no real
name:2**0': 0.14; 'confused.': 0.16; 'doc': 0.16; 'expected.':
0.16; 'gil': 0.16; 'skip:> 10': 0.16; 'subject:skip:m 10': 0.16;
'threading': 0.16; 'warning:': 0.16; 'cc:addr:python.org': 0.20;
"i've": 0.22; 'received:de': 0.23; 'cc:2**0': 0.25; 'bit': 0.27;
'encountered': 0.32; 'but': 0.32; 'header:In-Reply-To:1': 0.34;
'following': 0.35; 'use': 0.39; 'wrote': 0.39; 'situation': 0.40;
'method': 0.61; 'header:Received:6': 0.67; 'reasons': 0.84; '"")':
0.84; 'received:88': 0.84; 'thus,': 0.84; 'weird': 0.84; 'safely':
0.91
In-Reply-To: <sojj7k$1ek1$1@gioia.aioe.org>
X-Mailer: VM 8.0.12-devo-585 under 21.4 (patch 24) "Standard C" XEmacs Lucid
(x86_64-linux-gnu)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.38
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <25006.22672.283410.422526@ixdm.fritz.box>
X-Mailman-Original-References: <sojj7k$1ek1$1@gioia.aioe.org>
 by: Dieter Maurer - Mon, 6 Dec 2021 18:38 UTC

Johannes Bauer wrote at 2021-12-6 00:50 +0100:
>I'm a bit confused. In my scenario I a mixing threading with
>multiprocessing. Threading by itself would be nice, but for GIL reasons
>I need both, unfortunately. I've encountered a weird situation in which
>multiprocessing Process()es which are started in a new thread don't
>actually start and so they deadlock on join.

The `multiprocessing` doc
(--> "https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing")
has the following warning:
"Note that safely forking a multithreaded process is problematic."

Thus, if you use the `fork` method to start processes, some
surprises are to be expected.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor