Debian Codegraph @

debian/patches/multiprocessing-py3.14.patch

raw
1 Description: adapt to new multiprocessing code
2 Adapts the code to Python 3.14's change from fork to forkserver as the default
3 multiprocessing start method, which causes ConnectionResetError when using
4 multiprocessing.Manager() in certain environments (chroots, containers).
5 Author: Sascha Steinbiss <[email protected]>
6 Last-Update: 2026-07-05
7 --- a/ariba/clusters.py
8 +++ b/ariba/clusters.py
9 @@ -462,14 +462,17 @@
10 # memory, and thus bypass the NFS issues. The counter is accesses infrequently
11 # relative to computations, so the performance does not suffer.
12 # default authkey in the manager will be some generated random-looking string
13 - manager = multiprocessing.Manager()
14 + # Use 'fork' context explicitly to avoid Python 3.14's default 'forkserver' which
15 + # can cause ConnectionResetError in certain environments (e.g., chroot, containers)
16 + ctx = multiprocessing.get_context('fork')
17 + manager = ctx.Manager()
18 remaining_clusters = manager.Value('l',len(cluster_list))
19 # manager.Value does not provide access to the internal RLock that we need for
20 # implementing atomic -=, so we need to carry around a separate RLock object.
21 remaining_clusters_lock = manager.RLock()
22 try:
23 if self.threads > 1:
24 - self.pool = multiprocessing.Pool(self.threads)
25 + self.pool = ctx.Pool(self.threads)
26 cluster_list = self.pool.starmap(_run_cluster, zip(cluster_list, itertools.repeat(self.verbose), itertools.repeat(self.clean), itertools.repeat(self.fails_dir),
27 itertools.repeat(remaining_clusters),itertools.repeat(remaining_clusters_lock)))
28 # harvest the pool as soon as we no longer need it