Closed Bug 1406818 Opened 7 years ago Closed 7 years ago

Firefox hangs when deleting a heavily-used profile from "about:profiles"

Categories

(Toolkit :: Startup and Profile System, defect, P4)

56 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: dandromb, Assigned: baku)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Build ID: 20170926190823

Steps to reproduce:

- Open "about:profiles" in Firefox

- Click "Remove" (on an old and heavily-used profile)

- Click "Delete Files"


Actual results:

Firefox hangs for several seconds. About 10-20 seconds (or more?) on my netbook.

Not just the tab hangs, but the entire browser window became unresponsive.


Expected results:

Profile should either finish deleting faster, or else not freeze the browser UI.
I was cleaning up old profiles, deleting all the ones I don't use, and the browser hung two or three times in a row, as described above.

I tried to reproduce by creating a brand new profile and deleting it, but it deleted instantly (no hang). So the profile should have some browsing activity, maybe some stuff in the cache, maybe some bookmarks, I dunno.
Re: Comment #2

When experiencing this bug, the window fades out, and Windows tells me "Firefox is not responding".

I am sure that is a bug, not a feature.

On another note:

I should probably see how well I can reproduce this, but I'm not aware how to easily make (or clone) a heavily-used profile. I've deleted most of my profiles already, so this is becoming hard to test. 

Any advice for how to create "heavily-used" profiles quickly and easily?
Component: Untriaged → Preferences
(In reply to Dan D (Not an employee, just a tester) from comment #3)
> Any advice for how to create "heavily-used" profiles quickly and easily?

If you have a "heavily-used" profile, you could follow these steps to copy and restore it: http://kb.mozillazine.org/Profile_backup#Manually_back_up_the_profile
Component: Preferences → Startup and Profile System
Priority: -- → P4
Product: Firefox → Toolkit
It looks like it's one of these two calls that are really slow: http://searchfox.org/mozilla-central/source/toolkit/content/aboutProfiles.js#294-295

@Dan, can you use the add-on from https://perf-html.io/ to capture a performance profile and share it here? That will point to the specific part of our code that is slow.

@baku, can we do this profile deletion off the main-thread in a worker?
Flags: needinfo?(amarchesini)
​I wasn't able to reproduce the freezing up of the UI. My computer probably had some system activity in the background (virus scan?). The netbook I was using at the time can't really multi-task at all without slowing down. (I do see in the profiler that there is some blocking of the main thread. I might not notice it without a perf profile to look at, but it is there.)

Note: Only the last perf profile below had much cache on disk associated with it. It took quite a bit longer to delete than the others.

(It seems the cache folder for each profile is separate? I made duplicated Ffx profiles which were made from an old "main profile folder" only, and without being able to add the old "profile-specific cache folder" to the duplicated Ffx profile. Which seems to mean the duplicated Ffx profiles all had ~0MB cache on disk.)

(So I had to delete an original profile in order to actually have cache on disk to delete. That's the last perf profile below. The other perf profiles are from deleting duplicated (almost no cache on disk) Ffx profiles.)

Anyway, here are some profiles with different OS or Firefox versions.

https://perfht.ml/2xzxvmk - On my beefier computer (Linux Mint) (Firefox 56)

https://perfht.ml/2xz6tM2 - On my netbook (Windows 7) (Firefox 56)

https://perfht.ml/2kID8Zk - Netbook (Windows 7) (Firefox Nightly 58)​

https://perfht.ml/2xzpNZm - Netbook (Linux Mint) (Firefox 56)

https://perfht.ml/2kIrvBF - Netbook (Profile with lots of stored cache on disk), seemed to take twice as long (Linux Mint) (Firefox 56)
To reiterate and clarify: The last of the performance profiles above best approximates what I describe in comment #0.
Assignee: nobody → amarchesini
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(amarchesini)
Attachment #8917812 - Flags: review?(ehsan)
Attachment #8917813 - Flags: review?(ehsan)
Where have you seen that files delete instantly? Even OS deletes many files for some time. I have 3-year or more profile. It's hundreds of MBs and thousands of little files.
Comment on attachment 8917812 [details] [diff] [review]
part 1 - profile::removeInBackground

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

::: toolkit/profile/nsIToolkitProfile.idl
@@ +75,5 @@
>      void remove(in boolean removeFiles);
>  
>      /**
> +     * Removes the profile from the registry of profiles.
> +     * The profile directory is removed in a I/O thread.

Nit: * in the stream transport thread.
Attachment #8917812 - Flags: review?(ehsan) → review+
Attachment #8917813 - Flags: review?(ehsan) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/eeb89284500e
Introduce nsIToolkitProfile.removeInBackground to remove profile folder in a separate thread, r=ehsan
https://hg.mozilla.org/integration/mozilla-inbound/rev/322dbb6b6736
about:profile uses nsIToolkitProfile.removeInBackground, r=ehsan
Depends on: 1442200
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: