Closed Bug 1709672 Opened 4 years ago Closed 4 years ago

ResourceCommand's watchResources and unwatchResource still have race conditions

Categories

(DevTools :: Framework, defect, P1)

defect

Tracking

(Fission Milestone:M7a, firefox90 fixed)

RESOLVED FIXED
90 Branch
Fission Milestone M7a
Tracking Status
firefox90 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

(Whiteboard: dt-fission-m3-mvp)

Attachments

(5 files)

Bug 1708635 highlighted a race condition that still exists between watchResources and unwatchResources:
https://treeherder.mozilla.org/logviewer?job_id=338677989&repo=autoland&lineNumber=6500

[task 2021-05-04T14:50:19.411Z] 14:50:19     INFO - TEST-PASS | devtools/client/responsive/test/browser/browser_device_change.js | UA should be set to Mozilla/5.0 (Mobile; rv:39.0) Gecko/39.0 Firefox/39.0 - 
[task 2021-05-04T14:50:19.414Z] 14:50:19     INFO - Closing responsive design mode
[task 2021-05-04T14:50:19.700Z] 14:50:19     INFO - GECKO(1513) | console.error: "Exception while calling a ResourceCommand" "available" "callback" ":" (new Error("Stopped listening for resource 'document-event' that isn't being listened to", "resource://devtools
Assignee: nobody → poirot.alex

This isn't solely for performance reason.
This will help ensure calling _startListening synchronously when calling watchResources.
This is to help simplify the various states store to track which resources are being watched.
And ultimately fix races between watch and unwatch.

Calling it twice in a raw makes it never resolve.
The actor implementation could probably be made more resilient,
but memoizing it on the front would probably help reduce the number of request we are doing.

This issues appears with the first changeset, parellizing the call to ResourceCommand._startListening.

This is the ultimate change in order to ensure calling _startListening
synchronously from watchResources.

Fixes are required to styles tests, as watchAllTarget is only called if we pass a valid resource type.

Now that _startListening is synchronous, we can fix the race conditions
that exists between many calls made to watch and unwatch resources.
And we would benefit from simplifying the various ways to track
what resources is being watched.
We no either use _watchers and _pendindWatchers to have the live number
of registered listeners. And in parellel to that, only record
which resources is being watched on the server via _listenedResources.

Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P1
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e47322fa2d09 [devtools] Start listening to all resources in parallel. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/accb5722566d [devtools] Do not await on synchronous _stopListening method. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/a239123a371a [devtools] Memoize StorageActor.listStores result. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/9f6b42ce7f5d [devtools] Move the call to watchAllTargets. r=nchevobbe https://hg.mozilla.org/integration/autoland/rev/54ac35a2ef29 [devtools] Simplify how we track currently watched resources. r=nchevobbe
Whiteboard: dt-fission-m3-triage → dt-fission-m3-mvp
Fission Milestone: --- → M7a
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: