Closed Bug 1268569 Opened 9 years ago Closed 9 years ago

Don't remove HTTP cache doomed files after shutdown

Categories

(Core :: Networking: Cache, defect)

46 Branch
All
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox47 --- affected
firefox48 --- fixed
firefox49 --- fixed
firefox50 --- affected

People

(Reporter: mayhemer, Assigned: mayhemer)

References

Details

(Keywords: crash, Whiteboard: [necko-active])

Crash Data

Attachments

(1 file, 3 obsolete files)

According some OSX crashes, we apparently are trying to remove files from the cache2/doomed directory after shutdown. That is not necessary [Michal?], those can be left to be deleted on another browser run. Bug 913822 and bug 1239687 fixes are still inefficient in this. We need to set also mIsDoomed = false at https://hg.mozilla.org/mozilla-central/annotate/86730d0a82093d705e44f33a34973d28b269f1ea/netwerk/cache2/CacheFileIOManager.cpp#l2315
Flags: needinfo?(michal.novotny)
Blocks: 1263199
No longer depends on: 1263199
Attached patch v1 (obsolete) — Splinter Review
Flags: needinfo?(michal.novotny)
Attachment #8746691 - Flags: review?(michal.novotny)
Comment on attachment 8746691 [details] [diff] [review] v1 Review of attachment 8746691 [details] [diff] [review]: ----------------------------------------------------------------- This IMO isn't OK. mInvalid flag is used only to decide whether to remove file and entry from index when the handle is closed, so mangling this value is sort of OK. But changing mIsDoomed affects a lot of fundamental decisions in the cache code, e.g. the handle might be returned via CacheFileHandles::GetHandle(), entry in the index which either doesn't exist or there is already a new entry for a newer handle could be accessed, etc... Either we could create a new flag (e.g. mLeakIt), set it here to true and check it at places where we are removing the file, or we must do the IsPastShutdownIOLag check at those places to decide whether to remove the file or not.
Attachment #8746691 - Flags: review?(michal.novotny) → review-
Attached patch v2 (obsolete) — Splinter Review
- mLeakIt flag added to CacheFileHandle - I also reorganized some of the bool flags to be one of const field, atomic, or single-thread-access bool field to lower the class footprint (same should be done for CacheFile once) locally tested. https://treeherder.mozilla.org/#/jobs?repo=try&revision=fc65e1ef5e24
Attachment #8746691 - Attachment is obsolete: true
Attachment #8753961 - Flags: review?(michal.novotny)
Comment on attachment 8753961 [details] [diff] [review] v2 Review of attachment 8753961 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/cache2/CacheFileIOManager.cpp @@ +183,5 @@ > } else { > LOG(("CacheFileHandle::Log() - entry file [this=%p, hash=%08x%08x%08x%08x" > "%08x, isDoomed=%d, priority=%d, closed=%d, invalid=%d, fileExists=%d," > " fileSize=%lld, leafName=%s, key=%s]", this, LOGSHA1(mHash), > + int(mIsDoomed), bool(mPriority), int(mClosed), bool(mInvalid), bool(mFileExists), mFileSize, Please add logging of mLeakIt to CacheFileHandle::Log(). Maybe add pinning information too.
Attachment #8753961 - Flags: review?(michal.novotny) → review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
(In reply to Honza Bambas (:mayhemer) from comment #12) > Definitely not fixed: > https://crash-stats.mozilla.com/report/index/614812a7-787d-4bf8-b25c- > 700f62160528#allthreads Filed bug 1276869 on that.
Comment on attachment 8754874 [details] [diff] [review] v2.1 [actually updated to r] Approval Request Comment [Feature/regressing bug #]: http cache v2 [User impact if declined]: shutdown hang/crash [Describe test coverage new/current, TreeHerder]: a week on m-c, heavily exercised code [Risks and why]: low to my knowledge, this only leaves file descriptors open (leaks) for certain files [String/UUID change made/needed]: none
Attachment #8754874 - Flags: approval-mozilla-aurora?
Blocks: 1276869
Depends on: 1267980
Comment on attachment 8754874 [details] [diff] [review] v2.1 [actually updated to r] Fix a shutdown hang, taking it
Attachment #8754874 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
has problems to apply to aurora: merging netwerk/cache2/CacheFileIOManager.h warning: conflicts while merging netwerk/cache2/CacheFileIOManager.cpp! (edit, then use 'hg resolve --mark') abort: unresolved conflicts, can't continue (use 'hg resolve' and 'hg graft --continue')
Flags: needinfo?(honzab.moz)
(In reply to Carsten Book [:Tomcat] from comment #16) > has problems to apply to aurora: > > merging netwerk/cache2/CacheFileIOManager.h > warning: conflicts while merging netwerk/cache2/CacheFileIOManager.cpp! > (edit, then use 'hg resolve --mark') > abort: unresolved conflicts, can't continue > (use 'hg resolve' and 'hg graft --continue') a+ and land bug 1267980 first (if rejected then use the m-c landed patch for m-a). I was trying to make that clear, it's also in the list of dependencies.
Flags: needinfo?(honzab.moz)
Comment on attachment 8754874 [details] [diff] [review] v2.1 [actually updated to r] (In reply to Honza Bambas (:mayhemer) from comment #17) > (In reply to Carsten Book [:Tomcat] from comment #16) > > has problems to apply to aurora: > > > > merging netwerk/cache2/CacheFileIOManager.h > > warning: conflicts while merging netwerk/cache2/CacheFileIOManager.cpp! > > (edit, then use 'hg resolve --mark') > > abort: unresolved conflicts, can't continue > > (use 'hg resolve' and 'hg graft --continue') > > a+ and land bug 1267980 first (if rejected then use the m-c landed patch for > m-a). I was trying to make that clear, it's also in the list of > dependencies. The bug blocking this one has already landed on m-b, please try to reland the patch here now. Thanks.
Attachment #8754874 - Flags: approval-mozilla-beta?
Attachment #8754874 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Crash volume for signature 'shutdownhang | WaitForSingleObjectEx | WaitForSingleObject | PR_WaitCondVar | mozilla::CondVar::Wait | mozilla::net::ShutdownEvent::PostAndWait': - nightly (50): 6 - release (47): 45118 Affected platform: Windows
(In reply to Calixte Denizet (:calixte) from comment #20) > Crash volume for signature 'shutdownhang | WaitForSingleObjectEx | > WaitForSingleObject | PR_WaitCondVar | mozilla::CondVar::Wait | > mozilla::net::ShutdownEvent::PostAndWait': > - nightly (50): 6 There are few groups of Nightly crashes for this signature with buildid > 2016-06-23 (on which last fix around cache2 shutdown crashes landed): - CacheFileIOManager::DoomFileInternal https://crash-stats.mozilla.com/report/index/df5c746f-aba0-4096-8791-356702160711#allthreads - CacheFileIOManager::ReadInternal https://crash-stats.mozilla.com/report/index/bc245e5c-dd2e-46ee-9649-ed1d12160704#allthreads - CacheFileIOManager::MaybeReleaseNSPRHandleInternal https://crash-stats.mozilla.com/report/index/c0c7a8de-91bf-4d70-8cfa-7632c2160710#allthreads - mozilla::net::CacheFileContextEvictor::EvictEntries https://crash-stats.mozilla.com/report/index/fdab432f-6de2-4a1e-8b5c-ecff52160710#allthreads and one interesting, but probably just coincidence (no other tread keeping the lock found): - mozilla::net::CacheFileAutoLock::CacheFileAutoLock https://crash-stats.mozilla.com/report/index/0215c729-5fba-409c-9769-fb0502160630#allthreads The first set, according the code, are general IO hangs, not related to shutdown. We are hanging there a lot longer than before shutdown has even been initiated. There seems to be some ways to cancel a synchronous IO on Windows (since Vista). I'll file a new bug for that.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: