pez-globo / pufferfish-software

All software for the Pufferfish ventilator.
Apache License 2.0
0 stars 1 forks source link

Frontend is killed while changing the set values. #233

Closed Tanmay06 closed 3 years ago

Tanmay06 commented 4 years ago

Describe the bug The backend kills the frontend, when the user is setting any value through modal. Since the backend waits for ~1s of delay of message from the frontend before spawning the kill process, it seems like no messages from the frontend are sent when the modal is being operated.

To Reproduce

  1. Start the backend and the frontend in a linux machine.
  2. Open any modal
  3. Keep changing the value till the chromium browser is killed.

Expected behavior The backend should not kill the frontend.

Screenshots If applicable, add screenshots to help explain your problem.

Device (please complete the following information):

Software (please complete the following information):

ethanjli commented 4 years ago

This issue is related to #124: for some reasoning, opening the modal or doing other React graphics-redraw-heavy things appears to momentarily freeze all processing of the frontend (and with freeze durations which vary across different trials of the same test); when no waveform data is received by the frontend for a graph for 2 sec, then the graph resets itself. Obviously the backend is still sending that data, it is just getting dropped or rejected by the frontend (presumably because the frontend is frozen). I am not sure how we can solve this problem - @Sudhir-dev , do you have ideas for where the performance bottleneck might be that is causing such a long freeze in the frontend?

ethanjli commented 3 years ago

Out of curiosity, I had opened the Preact Dev Tools with redraw highlighting, and it looks like the frontend is wasting a lot redraws on things which aren't actually changing - this includes various pieces of the topbar, as well as almost everything in the dashboard. This is a big regression from dashboard implementation for the V1 UI/UX design, where only the curves themselves and the changed numbers triggered redraws. @Sudhir-dev How much of the dashboard consists of nested components, vs. containers which are passed in by dependency injection?

ethanjli commented 3 years ago

We will implement a work-around for this by limiting the rate at which the modal dialog's increment and decrement buttons may be clicked, to a rate which is low enough that the frontend can do some processing with the communication protocol in between button clicks. We can start by trying a rate-limit of a minimum of 50 ms between button-presses. In between those 50 ms intervals, the button should be temporarily disabled.

This applies to all increment and decrement buttons.