plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
21.19k stars 2.04k forks source link

requestQueue get stuck when browser is experiencing intensive navigation #992

Open byronz opened 4 years ago

byronz commented 4 years ago

Thank you so much for helping improve the quality of Dash!

We do our best to catch bugs during the release process, but we rely on your help to find the ones that slip through.

Describe your context Please provide us your environment so we can easily reproduce the issue.

Describe the bug

This is kind of reproducible with the current dash-docs PR for 1.5.1 upgrade, but we don't have fixed steps to reproduce it each time.

To give a little background about issue. We introduced a new feature/parameter in the visit_and_snapshot API, what it does is to detect if window.store exists and makes sure all the callbacks get fired and have a responseTime in the queue (refer to https://github.com/plotly/dash/blob/b3b9de9923d82ff1281889b3695d638e95bb1590/dash/testing/dash_page.py#L43-L48)

this mechanism works fine with the older dash version prior to the 1.5.x release. so the behavior is new. what I observed is that the tests in test_component.py are doing intensively url navigation in the browser, it basically goes through each sub section of dash docs in a very fast way, at some point, the request will get stuck with status = 'loading', a refresh of the page might solve the issue, but not always the case. the stuck point is always consistent on CircleCI and in a local setup. but not the same in the these two environments: i.e. circleci get stuck with /datatables/callbacks while local run might be /datatables/editable

this looks like a leak or something related to the recent async work

sample of a loading state https://circleci.com/api/v1.1/project/github/plotly/dash-docs/8326/output/106/0?file=true DEBUG dash.testing.dash_page:dash_page.py:48 status of state rq [{u'status': 200, u'requestTime': 1572637143419, u'uid': u'ba5537d0-617e-8488-94b8-0743ae70833e', u'controllerId': u'chapter.children', u'rejected': False, u'responseTime': 1572637143451}, {u'status': 200, u'requestTime': 1572637143564, u'uid': u'ffd418a2-6583-0b41-68e1-f87978e29b89', u'controllerId': u'datatable-paging.data', u'rejected': False, u'responseTime': 1572637144000}, {u'status': 200, u'requestTime': 1572637143625, u'uid': u'00824a87-cc96-bd10-14e8-47c488901e4f', u'controllerId': u'table-paging-with-graph.data', u'rejected': False, u'responseTime': 1572637144090}, {u'status': u'loading', u'controllerId': u'table-sorting-filtering.data', u'uid': u'2dd02b0a-e358-ac9f-24c1-66289dbd0643', u'requestTime': 1572637143676}, {u'status': u'loading', u'controllerId': u'table-filtering.data', u'uid': u'511a97fc-603d-7a33-49dd-343365d2e978', u'requestTime': 1572637143719}, {u'status': u'loading', u'controllerId': u'table-paging-and-sorting.data', u'uid': u'4680495b-ed49-5470-089c-cc8927d40451', u'requestTime': 1572637143766}, {u'status': u'loading', u'controllerId': u'datatable-paging-page-count.data', u'uid': u'0f143cab-e84b-05bb-befb-05d20eb61c83', u'requestTime': 1572637143824}, {u'status': u'loading', u'controllerId': u'datatable-paging-page-count.page_count', u'uid': u'cdfd9b8e-5619-35d0-a1a3-f4a844dc8f92', u'requestTime': 1572637143872}, {u'status': u'loading', u'controllerId': u'table-multicol-sorting.data', u'uid': u'e086324e-52c1-44ac-aeae-84f308e2508b', u'requestTime': 1572637143918}, {u'status': 200, u'requestTime': 1572637144762, u'uid': u'd85d3baf-7a61-d324-b09a-6c7efc6485c0', u'controllerId': u'table-paging-with-graph-container.children', u'rejected': False, u'responseTime': 1572637145068}]

alexcjohnson commented 4 years ago

Possibly related to #1008