posit-dev / posit-dev/py-shiny

Shiny Express app hangs on Connect

Open
#1,776 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage to-close
Dominant language
Python
Stars
1.8k
Forks
135
Avg merge
2d 18h
Merged PRs (30d)
21

Description

I ran into a very strange bug, which might be either a Shiny or Connect bug. When I deploy the basid dashboard template to our Connect server using both Core and Express the Express app takes about 45 seconds to load which the Core app loads instantly. The stick session app succeeds.

The debug logs for the Express app are here:

2024/11/19 13:35:04.058637232 Loading code from "shiny.express.app:app_2e_py"
2024/11/19 13:35:57.904598071 App type is "App"
2024/11/19 13:35:57.904814920 Starting server...
2024/11/19 13:36:00.293839042 SEND: {"config": {"workerId": "", "sessionId": "cff48836f74b4850ffc208110d658068fb5a62f89b95ef0d22057c572023960c", "user": null}}
2024/11/19 13:36:00.299205532 RECV: {"method":"init","data":{"mass":6000,"species":["Adelie","Gentoo","Chinstrap"],".clientdata_output_length_depth_width":669,".clientdata_output_length_depth_height":642,".clientdata_output_length_depth_bg":"rgb(255, 255, 255)",".clientdata_output_length_depth_fg":"rgb(29, 31, 33)",".clientdata_output_length_depth_accent":"rgb(0, 123, 194)",".clientdata_output_length_depth_font":{"families":["Open Sans","-apple-system","system-ui","Segoe UI","Roboto","Helvetica Neue","Arial","sans-serif"],"size":"16px"},".clientdata_output_count_hidden":false,".clientdata_output_bill_length_hidden":false,".clientdata_output_bill_depth_hidden":false,".clientdata_output_length_depth_hidden":false,".clientdata_output_summary_statistics_hidden":false,".clientdata_pixelratio":2,".clientdata_url_protocol":"https:",".clientdata_url_hostname":"posit.internal.evenup.law",".clientdata_url_port":"",".clientdata_url_pathname":"/content/29ea09cf-e36d-4251-a2ba-9032aa7b5233/",".clientdata_url_search":"",".clientdata_url_hash_initial":"",".clientdata_url_hash":"",".clientdata_singletons":""}}
2024/11/19 13:36:00.315070742 SEND: {"busy": "busy"}
2024/11/19 13:36:36.390832810 Executing <Task pending name='Task-51' coro=<WSProtocol.run_asgi() running at /opt/rstudio-connect/mnt/app/python/env/lib/python3.12/site-packages/uvicorn/protocols/websockets/wsproto_impl.py:234> cb=[WSProtocol.on_task_complete()] created at /opt/rstudio-connect/mnt/app/python/env/lib/python3.12/site-packages/uvicorn/protocols/websockets/wsproto_impl.py:189> took 36.092 seconds
2024/11/19 13:36:36.391022890 SEND: {"recalculating": {"name": "count", "status": "recalculating"}}
2024/11/19 13:36:36.393045940 SEND: {"recalculating": {"name": "count", "status": "recalculated"}}
2024/11/19 13:36:36.393607470 SEND: {"recalculating": {"name": "bill_length", "status": "recalculating"}}
2024/11/19 13:36:36.394038190 SEND: {"recalculating": {"name": "bill_length", "status": "recalculated"}}
2024/11/19 13:36:36.394689820 SEND: {"recalculating": {"name": "bill_depth", "status": "recalculating"}}
2024/11/19 13:36:36.395221190 SEND: {"recalculating": {"name": "bill_depth", "status": "recalculated"}}
2024/11/19 13:36:36.395416050 SEND: {"recalculating": {"name": "length_depth", "status": "recalculating"}}
2024/11/19 13:36:36.695437563 SEND: {"recalculating": {"name": "length_depth", "status": "recalculated"}}
2024/11/19 13:36:36.696027573 Executing <Task pending name='Task-51' coro=<WSProtocol.run_asgi() running at /opt/rstudio-connect/mnt/app/python/env/lib/python3.12/site-packages/uvicorn/protocols/websockets/wsproto_impl.py:234> cb=[WSProtocol.on_task_complete()] created at /opt/rstudio-connect/mnt/app/python/env/lib/python3.12/site-packages/uvicorn/protocols/websockets/wsproto_impl.py:189> took 0.301 seconds

I brought this up with our solutions engineer as well, but I wanted to raise an issue here in case it's something you all want to dig into, or had any advice about debugging steps.

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 with the basid dashboard template and compare its Core and Express deployments on Connect. Review the provided Connect debug logs, especially the delay between receiving init data and sending recalculation events. Done means identifying why the Express app takes about 45 seconds to load and confirming the behavior is resolved without affecting the working Core or stick-session app.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.