sub process listening to the same port

Viewed 81

I'm trying to pack my streamlit web app into an exe file using pyinstaller. My webapp use multiprocess like this

    def check_outside_multiprocess(self, lst_children_empty, lst_outside):
    lst_outside_tmp = [(x.pos, x.size) for x in lst_outside]
    if len(lst_children_empty) > 100:
        pool = Pool(4)

        data = [(x.pos, x.size, lst_outside_tmp) for x in lst_children_empty]
        results = pool.starmap(check_empty_connect_outside, data)
        pool.close()
        pool.join()
    else:
        results = []
        for node in lst_children_empty:
            results.append(check_empty_connect_outside(node.pos, node.size, lst_outside_tmp))

    return results

When I run my exe, the log indicates that the app runs smoothly up until the point of dividing multi processes: enter image description here

Here the Port 8501 is already in use log loops infinitely and appears 4 times each loop. I'm dividing 4 processes, so my guess is the first process takes up the 8501 port, and then the sub processes are somehow need to listen to other ports.

I'm pretty much guessing the cause of this bug because I don't know how to debug this further, any help is appreciated.

0 Answers
Related