posit-dev / py-shiny

Shiny for Python
https://shiny.posit.co/py/
MIT License
1.32k stars 81 forks source link

Shiny Express app hangs on Connect #1776

Open gshotwell opened 6 days ago

gshotwell commented 6 days ago

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.

gadenbuie commented 6 days ago

Thanks Gordon. Can you share package versions, particularly shiny, uvicorn and websockets?

gshotwell commented 6 days ago

It's a brand new installation so it should be the latest versions of everything

anyio==4.6.2.post1
appdirs==1.4.4
asgiref==3.8.1
asttokens==2.4.1
click==8.1.7
comm==0.2.2
contourpy==1.3.1
cycler==0.12.1
decorator==5.1.1
executing==2.1.0
faicons==0.2.2
fonttools==4.55.0
h11==0.14.0
htmltools==0.6.0
idna==3.10
ipython==8.18.0
ipywidgets==8.1.5
jedi==0.19.2
jupyter_core==5.7.2
jupyterlab_widgets==3.0.13
kiwisolver==1.4.7
linkify-it-py==2.0.3
markdown-it-py==3.0.0
matplotlib==3.9.2
matplotlib-inline==0.1.7
mdit-py-plugins==0.4.2
mdurl==0.1.2
narwhals==1.14.0
numpy==2.1.3
orjson==3.10.11
packaging==24.2
pandas==2.2.3
parso==0.8.4
patsy==1.0.1
pexpect==4.9.0
pillow==11.0.0
platformdirs==4.3.6
plotly==5.24.1
prompt-toolkit==3.0.36
ptyprocess==0.7.0
pure_eval==0.2.3
Pygments==2.18.0
pyparsing==3.2.0
python-dateutil==2.9.0.post0
python-multipart==0.0.17
pytz==2024.2
questionary==2.0.1
ridgeplot==0.1.30
scipy==1.14.1
seaborn==0.13.2
setuptools==75.5.0
shiny==1.2.1
shinywidgets==0.3.4
six==1.16.0
sniffio==1.3.1
stack-data==0.6.3
starlette==0.41.3
statsmodels==0.14.4
tenacity==9.0.0
traitlets==5.14.3
typing_extensions==4.12.2
tzdata==2024.2
uc-micro-py==1.0.3
uvicorn==0.32.0
watchfiles==0.24.0
wcwidth==0.2.13
websockets==14.1
widgetsnbextension==4.0.13

We do have a VPN running as well. My thought was it was related to the Express app being run twice and blocking something? I'm not sure.