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,
                            args=(__config,
                                __date_to_predict_for,
                                float(__hmn_fire_confidence_interval),
                                __display_historical_fires_on_maps,
                                st.session_state.raw_weather,
                                st.session_state.history))

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,))
    st.info("Done!")

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.