posit-dev / posit-dev/py-shiny

[Bug]: Apps reload multiple times on save when `--reload` is used

Open
#1,995 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.8k
Forks
135
Avg merge
2d 18h
Merged PRs (30d)
21

Description

Component

Other

Severity

P3 - Low (minor inconvenience)

Shiny Version

1.4.0

Python Version

3.12

Minimal Reproducible Example
...
Behavior

When I'm working on an app.py file and running it with shiny --reload, saving the file causes shiny to restart two times.

Here's some example output from a single save:

WARNING:  WatchFiles detected changes in 'examples/event/app.py'. Reloading...
INFO:     Shutting down
INFO:     connection closed
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [39459]
INFO:     Started server process [40731]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     127.0.0.1:58860 - "GET /?_positronRender%3D5 HTTP/1.1" 200 OK
INFO:     ('127.0.0.1', 58863) - "WebSocket /websocket/" [accepted]
INFO:     connection open
WARNING:  WatchFiles detected changes in 'examples/event/app.py'. Reloading...
INFO:     Shutting down
INFO:     connection closed
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [40731]
INFO:     Started server process [40733]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     127.0.0.1:58870 - "GET /?_positronRender%3D5 HTTP/1.1" 200 OK
INFO:     ('127.0.0.1', 58873) - "WebSocket /websocket/" [accepted]
INFO:     connection open
Error Messages (if any)

Environment
Mac

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with shiny --reload while saving examples/event/app.py, using the provided restart logs as the expected failure pattern. Trace the reload entry point and verify that one save produces only one shutdown and restart; there is no specific source file or test named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.