Closed Bug 1674495 Opened 5 years ago Closed 5 years ago

Signaling abort on an AbortSignal should immediately clear out the follower list

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: Waldo, Assigned: Waldo)

References

()

Details

Attachments

(1 file)

Signaling abort is supposed to empty out the signal's algorithms list. We don't do that right now, so a signal that's been aborted unnecessarily extends the lifetime of a bunch of unused data. We should follow the spec and clear this earlier. (This is only visible as keeping stuff alive too long -- no semantically visible change except in GC behavior.)

The set of patches in bug 1660555, at end, had a memory leak that I thought might possibly be this one. It doesn't appear that was the case. But we should do this regardless, and it's one less explanation of the leak to have to consider.

This operation could be implemented by calling Unfollow() on every follower. But that would mean individually removing each follower from the followers array and shifting array contents accordingly -- which would be quadratic. Instead, we should directly access the array and clear the links in each direction manually. (The signal->follower link isn't strong until bug 1660555 is complete, so clearing that is belt-and-suspenders for the moment.) And at that point, IMO it seems best for adding/removing to do so by direct access (and visibly paired modifying of the bidirectional links) as well, which proposed change was previously rejected on its own in bug 1660555.

Pushed by jwalden@mit.edu: https://hg.mozilla.org/integration/autoland/rev/8ae3d1a3a13a Signaling abort on an |AbortSignal| should make all its follower algorithms unfollow, per spec and to avoid unnecessarily extending lifetimes. r=smaug
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: