-
Notifications
You must be signed in to change notification settings - Fork 62
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
Garbage collection of live tracks #910
Comments
UAs probably GC tracks, it makes sense to me to keep it that way.
|
I am not opposed to adding a spec note, but I don't think it would be impactful enough for us to declare "mission accomplished." Is there anyone knowledgeable about GC that we could pull in to voice expert opinion? |
GC of live tracks is allowed, and should not be disallowed IMHO. Blocking cleanup of resources on JS calling an API correctly is something we actively work to avoid. We've removed APIs in the past over this #404 If individual user agents are leaking GC detection, that's an implementation bug IMHO, and up to that user agent to mitigate. |
Is there any user agent, real or theoretical, that could avoid leaking GC to the user? Per the spec, the user agent is supposed to have persistent privacy indicators that the user can easily observe. |
Other specs tend to provide rules like:
I think we do not want to allow the web page to observe GC. |
Exposing GC to a web page is a well-known concern, but exposing it to the end-user isn't AFAIK. |
I've experienced tracks stopping on me at unexpected moments due to GC in toy apps I'd written to test new API surfaces I'd implemented. It felt disconcerting. In my dev setup, I could of course easily fix it by storing the reference to the track in a global variable I called
|
That the camera stops and its light goes away when it is no longer used, is a feature of the browser, and a bug in the app. it seems prudent to free up resources and to alert the user they are no longer being observed. I'd argue that what's disconcerting to users (as opposed to web developers) is not that tracks end, but that camera lights stay on longer than expected. GoogleChrome/developer.chrome.com#4894 seems to confirm this. Marking this as editorial to add the note mentioned in #910 (comment). If anyone disagrees, please comment. |
This seems to agree with my earlier statement that: "By suppressing GC, we'll expose the bug and motivate the app devs to fix it, which is better for users - our top constituency." (Emphasis mine on both quotes.) What we seem to disagree on is the relative value of motivating an earlier fix vs. freeing up resources.
We agree here too.
I disagree. This is issue is proposing a normative change - it is not editorial. To stress again an argument I might have failed to highlight enough before - GC is unpredictable behavior, and users are (rightfully) distressed by unpredictable behavior. GC should not be exposed to the user through its side-effects. |
A clarifying question... In the original code snippet, as long as However, if |
I don't think that's the point, @bradisbell. We all agree that it's a bug in the application, and that the stream and track are eligible to be garbage collected. My argument here is that we have good reasons to consider specifying that GC should be suppressed in this particular case - please see my previous comments for the rationale. |
We do care a lot about the user using the UA at the time the track may be GCed. For that specific user, releasing the camera sooner is a good thing. We also care about hypothetical future users, or web developers testing their apps, but a little bit less that the previous user. |
Note that the camera, although "in use", sends frames into the void, and is not hurting the user's privacy. Possibly it's detrimental to their battery. My subjective opinion is that unpredictability (drawback) offsets battery (gain). |
Ah, the classic meme of Either way - the issue is not editorial, so I am removing that label. (And it wouldn't be editorial even if we end up closing the issue with no action.) |
I also agree that we shouldn't disallow GC of a live track that is not referenced anywhere. |
@jan-ivar has often complained about Chrome not (yet) implementing the requirement of transient activation for The same reasoning applies here. If a hypothetical browser performs GC once a second, Web developers will not realize their bug in letting go of tracks without stopping them, and the app-level bug they produce will only manifest on other browsers. |
I don't think it's the same reasoning. |
There are similarities and there are differences. It is the "same reasoning" if you compare the right metric. Here I am referring to Jan-Ivar's concerns that developers only check on some browsers and their apps break on other browsers. The case where apps break on Firefox because the |
Consider this snippet:
What happens now? Should the stream and its tracks be eligible for garbage collection? If so, there are user-facing side-effects.
Note that getDisplayMedia has similar issues. In some implementations (Chromium), an application could even heuristically observed GC this way, because tab-sharing adds an infobar that affects the viewport's size, and when it disappears the viewport changes back.
So should GC of live tracks be disallowed? Allowed? Encouraged?
Arguments for allowing GC:
Argument for disallowing GC:
The text was updated successfully, but these errors were encountered: