Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Writing software is more fun than working.


devel / comp.lang.python / Re: Execute in a multiprocessing child dynamic code loaded by the parent process

SubjectAuthor
o Re: Execute in a multiprocessing child dynamic code loaded by theDieter Maurer

1
Re: Execute in a multiprocessing child dynamic code loaded by the parent process

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

  copy mid

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

  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: Execute in a multiprocessing child dynamic code loaded by the
parent process
Date: Mon, 7 Mar 2022 19:16:11 +0100
Lines: 17
Message-ID: <mailman.240.1646676979.2329.python-list@python.org>
References: <20220306124208.orqbcezhqqeysdpe@gmail.com>
<25124.63881.205740.249595@ixdm.fritz.box>
<20220306204228.l5pzjzc6peytbshp@gmail.com>
<25126.19435.559817.664736@ixdm.fritz.box>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de L3VSig+QZSoX0I1ibTej5ATTcabizJMo1eRP4GW6Fj+A==
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.012
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'modules': 0.07; 'parent':
0.07; 'cc:addr:python-list': 0.09; 'child': 0.09; 'instances':
0.09; '"start': 0.16; '(instead': 0.16; 'executed': 0.16;
'indeed': 0.16; 'instance': 0.16; 'ones.': 0.16; 'pickle': 0.16;
'subject:child': 0.16; 'subject:code': 0.16; 'subject:dynamic':
0.16; 'subject:parent': 0.16; 'subject:skip:m 10': 0.16;
'windows.': 0.16; 'problem': 0.16; 'cc:addr:python.org': 0.20;
'received:de': 0.23; 'cc:2**0': 0.25; 'function': 0.27; 'default':
0.31; 'but': 0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34;
'class': 0.37; 'this.': 0.37; 'could': 0.38; 'put': 0.38; 'use':
0.39; 'wrote': 0.39; 'martin': 0.40; 'including': 0.60; 'copy':
0.63; 'process.': 0.65; 'lead': 0.67; 'foreign': 0.67;
'header:Received:6': 0.67; 'process,': 0.75; 'paola': 0.84;
'received:88': 0.84; 'subject: \n ': 0.84; 'performs': 0.93
In-Reply-To: <20220306204228.l5pzjzc6peytbshp@gmail.com>
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.39
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: <25126.19435.559817.664736@ixdm.fritz.box>
X-Mailman-Original-References: <20220306124208.orqbcezhqqeysdpe@gmail.com>
<25124.63881.205740.249595@ixdm.fritz.box>
<20220306204228.l5pzjzc6peytbshp@gmail.com>
 by: Dieter Maurer - Mon, 7 Mar 2022 18:16 UTC

Martin Di Paola wrote at 2022-3-6 20:42 +0000:
>>Try to use `fork` as "start method" (instead of "spawn").
>
>Yes but no. Indeed with `fork` there is no need to pickle anything. In
>particular the child process will be a copy of the parent so it will
>have all the modules loaded, including the dynamic ones. Perfect.
>
>The problem is that `fork` is the default only in Linux. It works in
>MacOS but it may lead to crashes if the parent process is multithreaded
>(and the my is!) and `fork` does not work in Windows.

Then, you must put the initialization (dynamically loading the modules)
into the function executed in the foreign process.

You could wrap the payload function into a class instances to achieve this.
In the foreign process, you call the instance which first performs
the initialization and then executes the payload.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor