streamlit: Cannot Ctrl+C to end streamlit process from CLI without an open tab (in Windows)
Checklist
- I have searched the existing issues for similar issues.
- I added a very descriptive title to this issue.
- I have provided sufficient information below to help reproduce this issue.
Summary
This has had a few comments in the forum and I couldn’t find mention in a current or closed issue, so documenting here. This is merely a minor inconvenience with an easy workaround for most, but noting for completeness/future searches.
In Windows, the streamlit run process cannot be terminated from command line with Ctrl+C if there are no connected tabs. The terminal itself must either be closed or a new tab open and connected to the session to register if Ctrl+C has been typed. The forum thread mentions a connection to tornado.
Reproducible Code Example
# Any valid streamlit app
import streamlit as st
st.write('hi')
Steps To Reproduce
- From a terminal in Windows,
streamlit run app.py. - Close any/all tabs connected to the session.
- Ctrl+C in the terminal (nothing happens)
- Open a tab and connect to the session
(terminal immediately registers the previous command and correctly proceeds
Stopping...)
Expected Behavior
Ctrl+C should stop the process even if there are no active users
Current Behavior
A connected tab is required to stop the process without closing the terminal
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version: 1.23.0
- Python version: 3.10.11
- Operating System: Windows 10
- Browser: Edge…or rather “none”
- Virtual environment: Conda
Additional Information
Thematically related to #6611
Are you willing to submit a PR?
- Yes, I am willing to submit a PR!
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 32
- Comments: 19 (2 by maintainers)
I’m on linux and facing similiar issues, essentially I can’t ctrl-c, I have to kill the process. However I’m launching streamlit through VS Code terminal and running a torch training loop, which might be a relevant.
Huh very interesting. Probably one of these bugs we never catch because nobody on the team uses Windows 😄 Thanks for tracking.
It is still an issue in Streamlit version 1.36.0 (Win 11 Pro 23H2, Python 3.9.19).
Same issue on Windows. The only way I can stop the process is to reopen the tab.
Can confirm this happens on windows in Git Bash. Suspect related to the code never reaching some kind of yield point and being able to handle an interupt signal.