Docker container keeps restarting on button press

I’m using digital ocean to host the docker image, an ngnix web server.
The docker image contains streamlit code that works normally, until I press a button in my webpage.

Specifically, this button in my code.

website = st.text_input(label="Website", placeholder="Website Here...")
  slider = st.slider("How many children links to check", min_value=0, max_value=100, value=3)
  
  col1, col2, col3 = st.columns(3)
  with col2:
    button = st.button("Generate")
  
  if button:
    with col2:
      with st.spinner('Generating...',):
        output = function_that_takes_time_to_finish(website, slider) 
    st.write(f"""{output}""")

Note that function_that_takes_time_to_finish has a debug print in its absolute start that doesn’t get printed, so the problem happens before any code that I’ve written gets to be executed.

As soon as I press the button, the docker container restarts, I can see that using docker ps.
Checking the logs of the docker container, I see nothing. only the streamlit IPs.

I don’t have any leads to debug. I know there might not be that much info to offer help, but I’m asking for any leads where I can search for the problem, any logs, etc.

Thanks

Hey again @AhmadRehan ,

This is most probably related to the nginx web server. Please check the forum for nginx threads, in case you have to configure things a certain way. My guess is that the request (when you click the button) doesn’t get routed to the right address, so it breaks and the container restarts.

1 Like

I will ask on the nginx forums.

But how do I see/manage what routes a streamlit app takes though to sync both up?

the streamlit error is

Connection error
Connection failed with status 404, and response "<html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx/1.18.0 (Ubuntu)</center> </body> </html> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> ".

inspecting with chrome gives

main.ac67fab5.js:2     GET https://site.com/_stcore/health 502 (Bad Gateway)
main.ac67fab5.js:2     GET https://site.com/_stcore/allowed-message-origins 502 (Bad Gateway)
main.ac67fab5.js:2     GET https://site.com/_stcore/health 404 (Not Found)
main.ac67fab5.js:2     GET https://site.com/_stcore/allowed-message-origins 404 (Not Found)