Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFPGAN推理,开进程池崩溃 #574

Open
zihaog0724 opened this issue Sep 30, 2024 · 0 comments
Open

GFPGAN推理,开进程池崩溃 #574

zihaog0724 opened this issue Sep 30, 2024 · 0 comments

Comments

@zihaog0724
Copy link

zihaog0724 commented Sep 30, 2024

开多进程,gfpgan/utils.py崩溃
定位原因:和python import package有关系

这四个import导致偶现的创建进程池崩溃
最小复现代码:

import os
import torch
from facexlib.utils.face_restoration_helper import FaceRestoreHelper
from torchvision.transforms.functional import normalize
from basicsr.utils import img2tensor, tensor2img
from gfpgan.archs.gfpganv1_clean_arch import GFPGANv1Clean
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan import RealESRGANer

import multiprocessing as mp
from multiprocessing import shared_memory, Pool

class WorkerManager:
    def __init__(self):
        self.preprocess_queue = mp.Manager().Queue(maxsize=400)
        print("init preprocess queue")
        self.pool = Pool(80)

if __name__ == '__main__':
    wm = WorkerManager()

偶现崩溃,崩溃日志如下:

*** Error in `python': double free or corruption (!prev): 0x00000000040e2610 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7340f)[0x7fc52b78440f]
/lib64/libc.so.6(+0x78c7e)[0x7fc52b789c7e]
/lib64/libc.so.6(+0x79957)[0x7fc52b78a957]
/lib64/ld-linux-x86-64.so.2(_dl_deallocate_tls+0x58)[0x7fc52c3f55a8]
/lib64/libpthread.so.0(+0x7237)[0x7fc52c1cd237]
/lib64/libpthread.so.0(+0x734f)[0x7fc52c1cd34f]
/lib64/libpthread.so.0(+0x82f8)[0x7fc52c1ce2f8]
/lib64/libc.so.6(clone+0x6d)[0x7fc52b7f7fad]
======= Memory map: ========
00400000-0041f000 r--p 00000000 00:27 133760731263                       /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/bin/python3.9
0041f000-00611000 r-xp 0001f000 00:27 133760731263                       /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/bin/python3.9
00611000-0070f000 r--p 00211000 00:27 133760731263                       /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/bin/python3.9
00710000-00711000 r--p 0030f000 00:27 133760731263                       /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/bin/python3.9
00711000-00748000 rw-p 00310000 00:27 133760731263                       /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/bin/python3.9
00748000-0076a000 rw-p 00000000 00:00 0
00bb0000-06f62000 rw-p 00000000 00:00 0                                  [heap]
7fc428000000-7fc428021000 rw-p 00000000 00:00 0
7fc428021000-7fc42c000000 ---p 00000000 00:00 0
7fc42c000000-7fc42c021000 rw-p 00000000 00:00 0
7fc42c021000-7fc430000000 ---p 00000000 00:00 0
7fc430000000-7fc430021000 rw-p 00000000 00:00 0
7fc430021000-7fc434000000 ---p 00000000 00:00 0
7fc434000000-7fc434021000 rw-p 00000000 00:00 0
7fc434021000-7fc438000000 ---p 00000000 00:00 0
7fc438000000-7fc438021000 rw-p 00000000 00:00 0
7fc438021000-7fc43c000000 ---p 00000000 00:00 0
7fc43c000000-7fc43c021000 rw-p 00000000 00:00 0
7fc43c021000-7fc440000000 ---p 00000000 00:00 0
7fc440000000-7fc440021000 rw-p 00000000 00:00 0
7fc440021000-7fc444000000 ---p 00000000 00:00 0
7fc446f7c000-7fc446ffc000 rw-p 00000000 00:00 0
7fc446ffc000-7fc446ffd000 r--p 00000000 00:27 262074534985               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/lib-dynload/_posixshmem.cpython-39-x86_64-linux-gnu.so
7fc446ffd000-7fc446ffe000 r-xp 00001000 00:27 262074534985               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/lib-dynload/_posixshmem.cpython-39-x86_64-linux-gnu.so
7fc446ffe000-7fc446fff000 r--p 00002000 00:27 262074534985               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/lib-dynload/_posixshmem.cpython-39-x86_64-linux-gnu.so
7fc446fff000-7fc447000000 r--p 00002000 00:27 262074534985               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/lib-dynload/_posixshmem.cpython-39-x86_64-linux-gnu.so
7fc447000000-7fc447001000 rw-p 00003000 00:27 262074534985               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/lib-dynload/_posixshmem.cpython-39-x86_64-linux-gnu.so
7fc447001000-7fc447041000 rw-p 00000000 00:00 0
7fc447041000-7fc447046000 r--p 00000000 00:27 184883191627               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/yaml/_yaml.cpython-39-x86_64-linux-gnu.so
7fc447046000-7fc447093000 r-xp 00005000 00:27 184883191627               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/yaml/_yaml.cpython-39-x86_64-linux-gnu.so
7fc447093000-7fc44709c000 r--p 00052000 00:27 184883191627               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/yaml/_yaml.cpython-39-x86_64-linux-gnu.so
7fc44709c000-7fc44709d000 r--p 0005a000 00:27 184883191627               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/yaml/_yaml.cpython-39-x86_64-linux-gnu.so
7fc44709d000-7fc44709f000 rw-p 0005b000 00:27 184883191627               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/yaml/_yaml.cpython-39-x86_64-linux-gnu.so
7fc44709f000-7fc4471a0000 rw-p 00000000 00:00 0
7fc4471a0000-7fc4471a8000 r--p 00000000 00:27 133772386281               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-39-x86_64-linux-gnu.so
7fc4471a8000-7fc4472be000 r-xp 00008000 00:27 133772386281               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-39-x86_64-linux-gnu.so
7fc4472be000-7fc4472fa000 r--p 0011e000 00:27 133772386281               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-39-x86_64-linux-gnu.so
7fc4472fa000-7fc4472fb000 ---p 0015a000 00:27 133772386281               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-39-x86_64-linux-gnu.so
7fc4472fb000-7fc4472fc000 r--p 0015a000 00:27 133772386281               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-39-x86_64-linux-gnu.so
7fc4472fc000-7fc447301000 rw-p 0015b000 00:27 133772386281               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_unuran/unuran_wrapper.cpython-39-x86_64-linux-gnu.so
7fc447301000-7fc447343000 rw-p 00000000 00:00 0
7fc447343000-7fc447348000 r--p 00000000 00:27 133772386275               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_rcont/rcont.cpython-39-x86_64-linux-gnu.so
7fc447348000-7fc447374000 r-xp 00005000 00:27 133772386275               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_rcont/rcont.cpython-39-x86_64-linux-gnu.so
7fc447374000-7fc447382000 r--p 00031000 00:27 133772386275               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_rcont/rcont.cpython-39-x86_64-linux-gnu.so
7fc447382000-7fc447383000 r--p 0003e000 00:27 133772386275               /data/gpu_env_common/env/anaconda3/envs/online_worker_test1/lib/python3.9/site-packages/scipy/stats/_rcont/rcont.cpython-39-x86_64-linux-gnu.so%

如果去掉下面这四个import

from basicsr.utils import img2tensor, tensor2img
from gfpgan.archs.gfpganv1_clean_arch import GFPGANv1Clean
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan import RealESRGANer

就不会崩溃。
请问如何解决呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant