Why can deadlocks occur when multiple processes are used in flask requests?

console output can see 111111, but the back is gone, look at the process deadlock, and can not steadily reproduce the problem. Come out 10 times and come out once and twice

def check(s,c):
    print(22222222222222)
    app = current_app._get_current_object()
    logger = current_app.logger
    ...

class fix_service(Resource):
    def post(self, service_id):
        ...
        logger.info("fix: {name} donestart check".format(name=service.name))
        -sharp check
        with multiprocessing.Pool() as pool:
            print(111111111)
            check_results = pool.starmap(check, containers)

        logger.info("fix: check done")
        ...
-sharp ps -elf
0 S root       6517   5322  0  80   0 - 50490 poll_s 10:54 ?        00:00:00 /usr/local/bin/python3.5 /usr/local/bin/gunicorn --threads 8 app:create_app("test") -b 0.0.0.0:18113 --access-lo
1 S root       6520   6517  1  80   0 - 290893 ep_pol 10:54 ?       00:00:10 /usr/local/bin/python3.5 /usr/local/bin/gunicorn --threads 8 app:create_app("test") -b 0.0.0.0:18113 --access-lo
1 S root       6730   6520  0  80   0 - 290690 futex_ 11:01 ?       00:00:00 /usr/local/bin/python3.5 /usr/local/bin/gunicorn --threads 8 app:create_app("test") -b 0.0.0.0:18113 --access-lo

(gdb) bt
-sharp0  0x00007f99c0e31a00 in sem_wait () from /lib64/libpthread.so.0
-sharp1  0x00007f99b5950ff1 in semlock_acquire (self=0x7f99ace44688, args=<value optimized out>, kwds=<value optimized out>) at /opt/soft/Python-3.5.2/Modules/_multiprocessing/semaphore.c:307
-sharp2  0x00007f99c10fd961 in PyCFunction_Call (func=0x7f99ad2000d8, args=0x7f99c16ff048, kwds=<value optimized out>) at Objects/methodobject.c:98
-sharp3  0x00007f99c1184f25 in call_function (f=<value optimized out>, throwflag=<value optimized out>) at Python/ceval.c:4705
-sharp4  PyEval_EvalFrameEx (f=<value optimized out>, throwflag=<value optimized out>) at Python/ceval.c:3236
-sharp5  0x00007f99c1185e99 in _PyEval_EvalCodeWithName (_co=<value optimized out>, globals=<value optimized out>, locals=<value optimized out>, args=<value optimized out>, argcount=1, 
Jun.09,2021
Menu