Can't stop streamlit app using Ctrl+C if the app has been closed in the browser

Summary

This is a continuation of a thread from last year: Streamlit server 1.5.1 from command line, hard to stop with CTRL C

This issue does not seem to be resolved and I am perplexed if this is intended behavior or an issue that has not been fixed. Basically if you have a streamlit app running and close the browser, trying to stop the app with ctrl+c does not work.

Steps to reproduce

  • close browser app when streamlit is running
  • ctrl+c in the terminal
  • app does not stop running
  • open the app from the URL link so it opens in the browser again
  • ctrl+c in the terminal
  • app stops running (yay!)

Expected behavior:

  • Launch streamlit from the terminal
  • Close browser
  • ctrl+c in the terminal
  • app stops running (yay!)

Actual behavior:

  • Launch streamlit from the terminal
  • Close browser
  • ctrl+c in the terminal
  • app does not stop running (boo!)

Debug info

  • Streamlit version: 1.19.0
  • Python version: 3.9.12
  • Using venv
  • OS version: Microsoft Windows 11 Home 10.0.22621 Build 22621
  • Browser version: Chrome Version 110.0.5481.178 (Official Build) (64-bit)

Requirements file

streamlit
omegaconf
Pillow

1 Like

I can confirm this behavior. When I close the browser tab, the terminal no longer responds to Ctrl+C, I have to kill the process or close the terminal session.
However, if I remember correctly, this behavior only occurs under Windows.
These are my boundary conditions: Windows 10, Firefox, cmder terminal, Streamlit 1.19.0
I have not tried other browsers or other terminals.

I have seen this in Windows 10 with both streamlit and jupyterlab (both use tornado).