Address misleading garbage handler warnings and fix another reference cycle#11552
Merged
Conversation
…ample) don't get logged as an object being cleaned up by the garbage collector. Specifically: * change the first log.error to a log.warning (so the error sound does not play). Note that this message still must be logged as it is the one that contains the stack trace showing where the garbage collection is running. * Increase the report count before logging any message in notifyOfObjectDeletion so that any objects deleted in the log calls themselves don't get tracked as the first object to be deleted. * Clear the garbage collection threadID in the gc hook before logging the final error, otherwise that error (and the error sound) is tracked as an object deletion.
…nfo is on the current focus, otherwise the caretObj may not be cleaned up and a reference cycle may remain.
feerrenrut
approved these changes
Sep 4, 2020
LeonarddeR
approved these changes
Sep 4, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Closes #11539
Summary of the issue:
GarbageHandler is printing quite a lot of warnings about objects, especially after interacting with an edit field in Mozilla Firefox.
There are two specific issues here, both illustrated in #11539.
Note that in #11539 it mentions the warnings appearing when loading pages. I think this is simply because a lot of objects are suddenly created / destroyed when loading pages and thus the garbage collector happens to run. But the underlying issue has already happened when starting to interact with a previous edit field.
1. Lots of warnings about IAccessibleText, IAccessibleAction etc:
There is still a possible reference cycle on ia2Web.editor due to MozillaCompoundTextInfo caching lastCaretObj. A previous pr tried to address this by removing this reference in event_loseFocus. However, there are times where this is cached outside of the focus, such as when fetching the caret when changing review modes, or pressing enter on an edit field switching from browseMode to focus mode.
Warnings such as the following are produced:
In these cases, as the object is never reused anyway, the caching makes no sense. We should only cache the caret if the compoundTextInfo is on the current focus.
2. Misleading warnings about WavePlayer:
As we log an error when garbageHandler is notified about the first object deletion in a collection run, incorrect logic around the report count meant that we were tracking the deletion of the WavePlayer that played the error sound for that error message. In fact it started producing silly stack traces where we were starting to recurse into notifyOfObjectDeletion:
Similarly: The final error logged when the garbage collection finished was happening before we had cleared the garbage collection threadID, thus again, the WavePlayer for that error, also was classed as being inappropriately deleted.
Description of how this pull request fixes the issue:
1. Lots of warnings about IAccessibleText, IAccessibleAction
MozillaCompoundTextInfo now only caches lastCaretObj if the compoundTextInfo is for the current focus. There is no benefit to doing it at other times, and it would not be cleaned up.
2. Misleading warnings about WavePlayer:
Testing performed:
Known issues with pull request:
None.
Change log entry:
None needed.