-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix orphaned zms processes accumulating on Montage page tab hide/show #4706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1046,7 +1046,7 @@ document.onvisibilitychange = () => { | |||||
| //closing should kill, hiding should stop/pause | ||||||
| for (let i = 0, length = monitors.length; i < length; i++) { | ||||||
| // Stop instead of pause because we don't want buffering in zms | ||||||
| monitors[i].stop(); | ||||||
| monitors[i].kill(); | ||||||
|
||||||
| monitors[i].kill(); | |
| monitors[i].stop(); |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1402,7 +1402,10 @@ document.onvisibilitychange = () => { | |||||||||||||||||
| prevStateStarted = 'played'; | ||||||||||||||||||
| //Stop only if playing (not paused). | ||||||||||||||||||
| // We might want to continue status updates so that alarm sounds etc still happen | ||||||||||||||||||
| monitorStream.stop(); | ||||||||||||||||||
| // Use kill() instead of stop() to send CMD_QUIT and terminate the zms | ||||||||||||||||||
| // process. stop() only sends CMD_STOP which leaves zms running, causing | ||||||||||||||||||
| // orphaned processes to accumulate each time the tab is hidden/shown. | ||||||||||||||||||
|
Comment on lines
+1405
to
+1407
|
||||||||||||||||||
| // Use kill() instead of stop() to send CMD_QUIT and terminate the zms | |
| // process. stop() only sends CMD_STOP which leaves zms running, causing | |
| // orphaned processes to accumulate each time the tab is hidden/shown. | |
| // First run the normal stop() cleanup while started is true, then use kill() | |
| // to send CMD_QUIT and terminate the zms process. stop() only sends CMD_STOP | |
| // which leaves zms running, causing orphaned processes to accumulate each time | |
| // the tab is hidden/shown if we don't also call kill(). | |
| monitorStream.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't read my comment above. hide/show shouldn't kill zms. If you kill it then everything stops. No audio alerts, etc. We just want to stop/pause video streaming.
Alternatively we could switch to monitor status polling instead of working through zms..
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -793,7 +793,10 @@ document.onvisibilitychange = () => { | |||||||||||||||||||||
| TimerHideShow = setTimeout(function() { | ||||||||||||||||||||||
| //Stop monitors when closing or hiding page | ||||||||||||||||||||||
| for (let i = 0, length = monitorData.length; i < length; i++) { | ||||||||||||||||||||||
| monitors[i].stop(); | ||||||||||||||||||||||
| // Use kill() instead of stop() to send CMD_QUIT and terminate the zms | ||||||||||||||||||||||
| // process. stop() only sends CMD_STOP which leaves zms running, causing | ||||||||||||||||||||||
| // orphaned processes to accumulate each time the tab is hidden/shown. | ||||||||||||||||||||||
|
Comment on lines
+796
to
+798
|
||||||||||||||||||||||
| // Use kill() instead of stop() to send CMD_QUIT and terminate the zms | |
| // process. stop() only sends CMD_STOP which leaves zms running, causing | |
| // orphaned processes to accumulate each time the tab is hidden/shown. | |
| // First perform a normal stop to run local cleanup (clear intervals, | |
| // reset activePlayer, etc.) and send CMD_STOP, then call kill() to | |
| // send CMD_QUIT and terminate the zms process. This avoids sending | |
| // CMD_STOP after CMD_QUIT while still ensuring full cleanup. | |
| if (monitors[i].started) { | |
| monitors[i].stop(); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline comment says “closing should kill, hiding should stop/pause”, but the hidden-tab timeout now calls
kill()(not stop/pause). Please update the comment to match the current behavior (and rationale) so future changes don’t reintroduce the issue.