Closed Bug 1223766 Opened 9 years ago Closed 9 years ago

Removing an actor from an actor pool should destroy it.

Categories

(DevTools :: General, defect)

defect
Not set
normal

Tracking

(firefox45 fixed)

RESOLVED FIXED
Firefox 45
Tracking Status
firefox45 --- fixed

People

(Reporter: ejpbruel, Assigned: ejpbruel)

References

Details

Attachments

(1 file, 1 obsolete file)

The way we deal with actor lifetimes is currently inconsistent, in the sense that removing an actor pool will destroy all actors in that pool, but removing a single actor from the pool will not destroy it.

This is somewhat unfortunate when the lifetime of a particular actor doesn't match that of any other actor: in that case, we either have to create a separate pool, containing only that single actor, or destroy the actor explicitly.

Note that this does not lead to problems when moving an actor from one pool to another: adding the actor to the new pool will remove it from the old one, without destroying it.
Note that this patch causes test failures in test_promises_object_timetosettle-02.js because that test is broken. See bug 1207702 for details.
Attachment #8686000 - Flags: review?(janx)
Depends on: 1207702
Blocks: 1221892
Blocks: 1212797, 1214248
Comment on attachment 8686000 [details] [diff] [review]
Removing an actor from an actor pool should destroy it.

Review of attachment 8686000 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks Eddy! From what I can tell your patch looks OK, but please eventually run it by treeherder to make sure it won't break any tests.

I don't feel very comfortable reviewing this actor-lifetime change in the limited time I have, so I'll forward the rest of the review to Alex. Please direct any follow-up review requests to him as well.

Also, I think you forgot a call site[0] of `ActorPool.cleanup()`.

[0] https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/promises.js#229

::: devtools/server/actors/common.js
@@ +217,5 @@
>  }
>  
>  ActorPool.prototype = {
>    /**
> +   * Run all actor cleanups.

Nit: "Remove all remaining actors"?

::: devtools/server/main.js
@@ +1386,5 @@
>      let index = this._extraPools.lastIndexOf(aActorPool);
>      if (index > -1) {
>        let pool = this._extraPools.splice(index, 1);
>        if (!aNoCleanup) {
> +        pool.map(function(p) { p.destroy(); });

Nit: I find it strange to call `map()` on an array that will only ever have one element.

What about `let pool = this._e.splice(index, 1)[0]` and then `pool.destroy()`?
Attachment #8686000 - Flags: review?(poirot.alex)
Attachment #8686000 - Flags: review?(janx)
Attachment #8686000 - Flags: feedback+
(P.S. Nevermind my comment about try runs, I see you already sent one.)
New patch with nits by Jan addressed.
Attachment #8686000 - Attachment is obsolete: true
Attachment #8686000 - Flags: review?(poirot.alex)
Attachment #8686464 - Flags: review?(poirot.alex)
Comment on attachment 8686464 [details] [diff] [review]
Removing an actor from an actor pool should destroy it.

Alex took the day off. Panos, could you please have a look instead? I already pre-reviewed the patch, but I'd love feedback from someone who knows actor/pool lifetimes better than me.
Attachment #8686464 - Flags: review?(poirot.alex) → review?(past)
Comment on attachment 8686464 [details] [diff] [review]
Removing an actor from an actor pool should destroy it.

Review of attachment 8686464 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me, thanks!
Attachment #8686464 - Flags: review?(past) → review+
Comment on attachment 8686464 [details] [diff] [review]
Removing an actor from an actor pool should destroy it.

Review of attachment 8686464 [details] [diff] [review]:
-----------------------------------------------------------------

I believe you can also remove the use of `cleanup` from protocol.js:

https://dxr.mozilla.org/mozilla-central/source/devtools/server/protocol.js#833
https://hg.mozilla.org/mozilla-central/rev/3da6ad8bb8a9
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: