多处理池挂起

问题描述 投票:1回答:1

我创建了一个Pool来使用Gitpython进行git clone。有一个很大的git repo,需要比其他人更多的时间来克隆。每个过程都会为一个仓库进行克隆工作。我使用的Pool如下:

multi_res = [p.apply_async(runfunc, args=(incl_info, project_root, skip_dirs,)) 
                for incl_info in incl_infos]
LogInfo('Waiting for all subprocesses done...')
for i in range(len(incl_infos)):
    while not multi_res[i].ready():
        LogInfo("Downloading now")
        time.sleep(5)
p.close()
p.join()

在大多数情况下,它都能正常工作。但是通常会挂在最大的回购中。有线的是,当我只是单独克隆存储库时,它可以正常工作。所以我想知道python multiprocessing.Pool中是否有某些块。

我跟踪了绞死的git clone过程。 git进程输出如下:

Process 27649 attached
read(6, 0x7ffc36dae050, 4)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL, si_value={int=2895997, ptr=0x2c307d}} ---
rt_sigreturn()                          = 0
read(6, 0x7ffc36dae050, 4)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL, si_value={int=2895997, ptr=0x2c307d}} ---
rt_sigreturn()                          = 0
read(6, 0x7ffc36dae050, 4)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL, si_value={int=2895997, ptr=0x2c307d}} ---
rt_sigreturn()                          = 0
read(6, 0x7ffc36dae050, 4)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL, si_value={int=2895997, ptr=0x2c307d}} ---
rt_sigreturn()                          = 0

git-lfs输出如下:

Process 28006 attached
[ Process PID=28006 runs in 32 bit mode. ]
futex(0x88b982c, FUTEX_WAIT_PRIVATE, 0, NULL

等待您的帮助。

python multiprocessing gitpython
1个回答
0
投票

确定,我已经找到原因了。这是因为我使用了gitpython lib,并且有时挂起。

© www.soinside.com 2019 - 2024. All rights reserved.