Closed
Bug 1173380
Opened 9 years ago
Closed 9 years ago
[mozprofile] cloned profiles are not cleaned (__del__ method does not seems to be called)
Categories
(Testing :: Mozbase, defect)
Testing
Mozbase
Tracking
(firefox41 fixed)
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: parkouss, Assigned: parkouss)
References
Details
Attachments
(1 file)
2.36 KB,
patch
|
ahal
:
review+
|
Details | Diff | Splinter Review |
So this is a follow up of bug 1173335. I reduced the test case to reproduce the issue: import os import shutil from mozprofile.profile import Profile profile = Profile() profile_dir = profile.profile # do not automatically remove the profile path # for this profile instance, so we can clone it. profile.cleanup = lambda : None del profile assert os.path.exists(profile_dir) # create a clone from this profile path clone = Profile.clone(profile_dir) clone_profile_dir = clone.profile # removing the clone should remove the profile del clone try: # but it does not assert not os.path.exists(clone_profile_dir) except AssertionError: shutil.rmtree(clone_profile_dir) raise finally: shutil.rmtree(profile_dir)
Assignee | ||
Comment 1•9 years ago
|
||
hmm, this is strange because there is a tests/test_clone_cleanup.py that is intended to test this I would say.
Assignee | ||
Comment 2•9 years ago
|
||
Ah, no, this is not exactly the same thing: http://code.metager.de/source/xref/mozilla/firefox/testing/mozbase/mozprofile/tests/test_clone_cleanup.py#34 There is an explicit call to cleanup(); If I replace the line with "del clone", it does not work.
See Also: 642843 →
Assignee | ||
Comment 3•9 years ago
|
||
Well, I found the root cause, and fixed it. Here is a copy paste of the discussion with :whimboo that can help to understand the patch: 10:04 parkouss this is quite easy, it only use the *create_new* cariable we discussed 10:05 parkouss somewhere the decorator seems to keep a reference to the instance 10:05 parkouss well this is my understanding 10:05 parkouss test pass with the new code, fails without 10:07 whimboo so we had duplicated code beside __del__ which was responible only for deleting files of a cloned profile? 10:08 whimboo regarding the review please pass it to ahal or wlach I would say 10:08 parkouss it seems like that to me 10:08 parkouss ok 10:09 whimboo this would be awkward given that the cloned profile is also a profile class instance 10:09 whimboo and should rely on the same cleanup code as defined on the Profile class 10:09 parkouss well I think this is because we wanted by default to remove a cloned profile (when restore is True) 10:10 parkouss but the profile constructor won't let this happen if you pass a profile path 10:10 parkouss I suppose this was the reason 10:11 parkouss override the __del__ so cloned are deleted even if the profile path is set (assuming that restore is True)
Assignee: nobody → j.parkouss
Status: NEW → ASSIGNED
Attachment #8620843 -
Flags: review?(ahalberstadt)
Comment 4•9 years ago
|
||
Comment on attachment 8620843 [details] [diff] [review] 1173380.patch Review of attachment 8620843 [details] [diff] [review]: ----------------------------------------------------------------- Clever, thanks for finding this!
Attachment #8620843 -
Flags: review?(ahalberstadt) → review+
Assignee | ||
Comment 5•9 years ago
|
||
:ahal, do you think a try push is needed here, or can I land this directly ?
Flags: needinfo?(ahalberstadt)
Comment 6•9 years ago
|
||
Doesn't hurt to do a try push, probably just builds for the three major platforms and a test job or two are sufficient.
Flags: needinfo?(ahalberstadt)
Assignee | ||
Comment 7•9 years ago
|
||
Pushed to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=16a200653f0b
Comment 9•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/9a3fa532721b
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Comment 10•9 years ago
|
||
for some reason my local instance of talos is picking up this change and I am not able to run talos successfully. Oddly enough we have requirements.txt that has 'mozprofile==0.23', but that isn't being respected- maybe there is a dependency somewhere else. maybe we can figure out how to use profiles properly in talos so we can upgrade to 0.24?
Flags: needinfo?(j.parkouss)
Assignee | ||
Comment 11•9 years ago
|
||
Yep, upgrading to mozprofile 0.24 should be easy - I created a bug for that: Bug 1180664.
Flags: needinfo?(j.parkouss)
You need to log in
before you can comment on or make changes to this bug.
Description
•