Closed Bug 1091330 Opened 10 years ago Closed 8 years ago

Clear history when firefox closes causes 1 min hang during Win7 x64 shutdown/reboot

Categories

(Core :: Networking: Cache, defect)

49 Branch
x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: sponge_bob_128, Unassigned)

References

Details

(Whiteboard: [necko-backlog])

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20141021 Firefox/24.9 PaleMoon/25.0.2
Build ID: 20141021154425

Steps to reproduce:

In 33.0.2 (no/blank page),  Set "Clear history when firefox closes".  Shutdown/reboot Win7 x64.


Actual results:

Firefox hangs and Windows 7 shows message that Firefox must be closed before reboot.   If wait a minute, Firefox terminates and machine shutsdown/reboots.  If cancel shutdown, Firefox still terminates in a minute. Does not do it when "clear history" is not set.


Expected results:

Firefox should terminate immediately (just as if it was closed manually).
Please check if the issue occurs using Firefox in safe mode (with your addons disabled):
http://support.mozilla.com/kb/Safe+Mode

And on a new, empty profile:
http://support.mozilla.org/en-US/kb/Managing-profiles#w_starting-the-profile-manager
Flags: needinfo?(sponge_bob_128)
Yes it does it with a new profile and in safemode and with all plugins disabled (plus disabled warning when closing multiple tabs).
Confirmed in 36.0a1 (2014-11-03) Win 7 x64
Blocks: 920573
Status: UNCONFIRMED → NEW
Component: Untriaged → Networking: Cache
Ever confirmed: true
Product: Firefox → Core
Not sure this is a valid bug.  If you want the cache be deleted on shutdown, it simply has to take time.  You simply have to wait :)
But should take so long on a clean profile ?
Flags: needinfo?(sponge_bob_128) → needinfo?(honzab.moz)
(In reply to Paul Silaghi, QA [:pauly] from comment #5)
> But should take so long on a clean profile ?

If you mean almost empty cache by "clear profile" then it shouldn't take a long time. Btw. I cannot reproduce it on Linux. You confirmed the bug, so how big was the cache and how long it took to close Firefox in your case?
Flags: needinfo?(honzab.moz)
(In reply to Michal Novotny (:michal) from comment #6)
> how big was the cache
What exactly should I measure ?

> and how long it took to close Firefox in your case?
~ 1 min
(In reply to Paul Silaghi, QA [:pauly] from comment #7)
> (In reply to Michal Novotny (:michal) from comment #6)
> > how big was the cache
> What exactly should I measure ?

Definitely the number of files under cache2/entries and cache2/doomed

> 
> > and how long it took to close Firefox in your case?
> ~ 1 min

For how long was Firefox running before shutdown?
I don't think this is necessarily related to cache2 - this was reported as an issue in a Mozilla tree without cache2 as well. It seems there's different handling of "Exit Firefox" and a system-initiated exit when the system is shutting down.
(In reply to Honza Bambas (:mayhemer) from comment #8)
> Definitely the number of files under cache2/entries and cache2/doomed
entries: 37 = 800 KB
doomed: 0 

> For how long was Firefox running before shutdown?
10 seconds - just open Firefox with new profile, check "Clear history when Firefox closes" and then restart Windows
Paul, can you please measure how exactly long it takes for Firefox (under the same conditions as in comment 10) to close from the moment the window is shown and from the moment you tell it to shutdown?

Could you also check stack traces of each thread during the period you would expect Firefox be already shut down?

Thanks!
Flags: needinfo?(paul.silaghi)
(In reply to Honza Bambas (:mayhemer) from comment #11)
> Paul, can you please measure how exactly long it takes for Firefox (under
> the same conditions as in comment 10) to close from the moment the window is
> shown
After I press the "Shut down Windows" button and the "1 program still needs to close" window appears, it takes 42s until the process is closed
> and from the moment you tell it to shutdown?
Do you mean when I click the X button in the browser ?  ~3s until the process disappears from the Windows Task Manager

> Could you also check stack traces of each thread during the period you would
> expect Firefox be already shut down? 
I'm having some trouble with WinSDK/WinDbg due to a recent OS reinstall, I'll need to investigate this first. But I'm not sure exactly how can I get the stack trace while Windows is shutting down.
Flags: needinfo?(paul.silaghi)
(In reply to Paul Silaghi, QA [:pauly] from comment #12)
> (In reply to Honza Bambas (:mayhemer) from comment #11)
> > Paul, can you please measure how exactly long it takes for Firefox (under
> > the same conditions as in comment 10) to close from the moment the window is
> > shown
> After I press the "Shut down Windows" button and the "1 program still needs
> to close" window appears, it takes 42s until the process is closed
> > and from the moment you tell it to shutdown?
> Do you mean when I click the X button in the browser ?  ~3s until the
> process disappears from the Windows Task Manager

To explain what I want: I suspect we are blocked on something we schedule to happen 1 minute after start.  That's the reason I'm asking how long it takes between browser start (appearance) and actual shutdown.

> 
> > Could you also check stack traces of each thread during the period you would
> > expect Firefox be already shut down? 
> I'm having some trouble with WinSDK/WinDbg due to a recent OS reinstall,
> I'll need to investigate this first. But I'm not sure exactly how can I get
> the stack trace while Windows is shutting down.

Maybe you just need to close Firefox to reproduce the shutdown hang?  No need to shutdown whole Windows?  

I don't think you can get stack (easily) while in shutdown process, but you could cancel the shutdown and try to catch the process's main thread stack in WinDbg (having the correct symbols for it, of course.), can be a real race, tho :)
Maybe I'm mistaken, but isn't this something similar to bug 1005487 comment 13 (which points to a problem with spawning a new worker upon shutdown)? Is a worker spawned after the caller has entered shutdown status, perhaps, leaving the worker thread hanging until Firefox simply gives up after a timeout and closes?
(In reply to Honza Bambas (:mayhemer) from comment #13)
> Maybe you just need to close Firefox to reproduce the shutdown hang?  No
> need to shutdown whole Windows?  
It only reproduces on Windows shutdown.

> To explain what I want: I suspect we are blocked on something we schedule to
> happen 1 minute after start.  That's the reason I'm asking how long it takes
> between browser start (appearance) and actual shutdown.
2-3s. There is no difference if I manually close FF right after start or after 10 min. So, there is no issue here.
Whiteboard: [necko-backlog]
No longer does this for me in Firefox x64 49.0.1.  Windows 7 x64 (Updated to Sept 16 Patches).
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Version: 33 Branch → 49 Branch
You need to log in before you can comment on or make changes to this bug.