Pool.apply_async never ending loop

My app is working correctly locally but when I deploy it I am getting stuck and never leaving my pool.apply_async call. Here is the code:

result = pool.apply_async(func=runHumanFOPModel,

But the function runHumanFOPModel is never actually getting called it just runs this pool forever. I know it is not getting called by putting a print statement in the beginning of the function runHumanFOPModel that never gets printed. Any ideas? Thank you so much!

I ran this simple application multiple times. Not reruns, but actually killing streamlit and starting it again (in the same terminal, in case it matters).

from multiprocessing import Pool

import streamlit as st

def f(x):
    return x * x

if __name__ == "__main__":
    with Pool() as pool:
        result = pool.apply_async(func=f, args=(10,))

Sometimes it worked as I expected, the info widget was shown.

Sometimes it kept running forever, it never got to show the info widget unless I clicked “Stop”.

I developed some weird superstitions while doing the experiment, it wasn’t pretty.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.