Closed Bug 1128768 Opened 10 years ago Closed 10 years ago

Add type of swf file to flash hang annotations

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
normal

Tracking

(firefox39 fixed)

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: bugzilla, Assigned: bugzilla)

References

Details

Attachments

(5 files, 9 obsolete files)

(deleted), patch
vladan
: review+
Details | Diff | Splinter Review
(deleted), patch
bugzilla
: review+
Details | Diff | Splinter Review
(deleted), patch
bugzilla
: review+
Details | Diff | Splinter Review
(deleted), patch
jimm
: review+
Details | Diff | Splinter Review
(deleted), patch
bugzilla
: review+
Details | Diff | Splinter Review
For privacy reasons we won't log the actual URL. Instead we'll flag whether the swf file is an ad or came from Facebook.
Depends on: 1132305
This bug requires us to be able to determine which actor is highest in the call stack during a plugin hang.
Attachment #8566414 - Flags: review?(dvander)
Attached patch Part 2: Refactor hang annotations code (obsolete) (deleted) — Splinter Review
Attachment #8566415 - Flags: review?(vdjeric)
Attached patch Part 4: Telemetry changes (obsolete) (deleted) — Splinter Review
Attachment #8566421 - Flags: review?(rvitillo)
Attached patch Part 5 - Plugin changes (preliminary) (obsolete) (deleted) — Splinter Review
WIP of plugin changes. Annotates the entire SWF URL, which of course we don't want in the final revision.
Attachment #8566421 - Flags: review?(rvitillo) → review?(gfritzsche)
Comment on attachment 8566414 [details] [diff] [review] Part 1: Get topmost routing id from MessageChannel Review of attachment 8566414 [details] [diff] [review]: ----------------------------------------------------------------- ::: ipc/glue/MessageChannel.h @@ +134,5 @@ > bool IsOnCxxStack() const { > return !mCxxStackFrames.empty(); > } > > + int32_t GetTopmostMessageRoutingId() const; r=me w/ a comment here explaining what this should be used for.
Attachment #8566414 - Flags: review?(dvander) → review+
Addressed comments. Carrying forward r+.
Attachment #8566414 - Attachment is obsolete: true
Attachment #8567173 - Flags: review+
Attached patch Part 2: Refactor hang annotations code (r2) (obsolete) (deleted) — Splinter Review
Attachment #8566415 - Attachment is obsolete: true
Attachment #8566415 - Flags: review?(vdjeric)
Attachment #8568289 - Flags: review?(vdjeric)
Attached patch Part 4: Telemetry changes (r2) (obsolete) (deleted) — Splinter Review
Attachment #8566421 - Attachment is obsolete: true
Attachment #8566421 - Flags: review?(gfritzsche)
Attachment #8568290 - Flags: review?(gfritzsche)
Attached patch Part 5: Plugin changes (obsolete) (deleted) — Splinter Review
This patch grabs a mutex whenever entering or leaving a call or sync send, but it should rarely be contended (and even then only immediately after a hang).
Attachment #8566422 - Attachment is obsolete: true
Attachment #8568292 - Flags: review?(jmathies)
Comment on attachment 8568290 [details] [diff] [review] Part 4: Telemetry changes (r2) Review of attachment 8568290 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/telemetry/Telemetry.cpp @@ +2661,5 @@ > + if (!jsAnnotation) { > + continue; > + } > + nsAutoPtr<HangAnnotations::Enumerator> annotationsEnum; > + if (!(*i)->GetEnumerator(annotationsEnum.StartAssignment())) { For readability you could use a temporary, e.g.: const UniquePtr<HangAnnotations>& ptr = *i; ::: toolkit/components/telemetry/ThreadHangStats.h @@ +120,5 @@ > HangStack mNativeStack; > // Use a hash to speed comparisons > const uint32_t mHash; > + // Annotations attributed to this stack > + Vector<UniquePtr<HangMonitor::HangAnnotations>> mAnnotations; Can we typedef this to, say, something like |HangAnnotationVector|? This would make this file and Telemetry.cpp look cleaner.
Attachment #8568290 - Flags: review?(gfritzsche) → review+
As mentioned on IRC, i think this feature should get some basic test coverage. We could: * fake a flash plugin (i.e. fake the mimetype etc. like dom/plugins/test/testplugin/javaplugin/) * run the plugin in a mochitest-chrome * use plugin.stallPlugin() * collect the telemetry payload and sanity check things
Comment on attachment 8568292 [details] [diff] [review] Part 5: Plugin changes Review of attachment 8568292 [details] [diff] [review]: ----------------------------------------------------------------- Genrally this looks good, just "comment me" comments. r- though since I'd really like to see the next revision. ::: dom/plugins/base/nsPluginPlayPreviewInfo.h @@ +22,5 @@ > const char* aRedirectURL, > const char* aWhitelist); > explicit nsPluginPlayPreviewInfo(const nsPluginPlayPreviewInfo* aSource); > > + static nsresult CheckWhitelist(const nsACString& aPageURI, lets add a good comment for this, since it's now a public static util. ::: dom/plugins/ipc/PluginInstanceParent.cpp @@ +55,5 @@ > #elif defined(XP_MACOSX) > #include <ApplicationServices/ApplicationServices.h> > #endif // defined(XP_MACOSX) > > +static const char kShumwayWhitelistPref[] = "shumway.swf.whitelist"; nit - comment me @@ -142,5 @@ > #endif > } > > bool > -PluginInstanceParent::Init() we finally found a use for this! :) @@ +170,5 @@ > + if (NS_FAILED(rv)) { > + return false; > + } > + auto whitelist = Preferences::GetCString(kShumwayWhitelistPref); > + if (whitelist.IsEmpty()) { Lets add a comment here about the importance of this check - it looks like CheckWhitelist considers an empty string to be a "match everything" case. We don't want someone removing this accidentally. ::: dom/plugins/ipc/PluginInstanceParent.h @@ +278,5 @@ > + aOutput = mSrcAttribute; > + } > + > + bool > + IsWhitelistedForShumway() const comment me please. ::: dom/plugins/ipc/PluginModuleParent.cpp @@ +870,5 @@ > + mProtocolCallStack.RemoveElementAt(mProtocolCallStack.Length() - 1); > +} > + > +mozilla::ipc::IProtocol* > +PluginModuleChromeParent::GetInvokingProtocol() this whole method could stand some commenting. What are the two routingId checks for for example?
Attachment #8568292 - Flags: review?(jmathies) → review-
Attached patch Part 2: Refactor hang annotations code (r3) (obsolete) (deleted) — Splinter Review
Updated as a consequence of changes made to other patches.
Attachment #8568289 - Attachment is obsolete: true
Attachment #8568289 - Flags: review?(vdjeric)
Attachment #8569538 - Flags: review?(vdjeric)
Attached patch Part 4: Telemetry changes (r3) (deleted) — Splinter Review
Addressed Georg's comments. Will address tests in separate patches. Carrying forward r+.
Attachment #8568290 - Attachment is obsolete: true
Attachment #8569539 - Flags: review+
Attached patch Part 5: Plugin changes (r2) (deleted) — Splinter Review
Addressed all comments.
Attachment #8568292 - Attachment is obsolete: true
Attachment #8569540 - Flags: review?(jmathies)
Attachment #8569540 - Flags: review?(jmathies) → review+
Comment on attachment 8569538 [details] [diff] [review] Part 2: Refactor hang annotations code (r3) Review of attachment 8569538 [details] [diff] [review]: ----------------------------------------------------------------- ::: xpcom/threads/HangAnnotations.cpp @@ +16,5 @@ > +namespace HangMonitor { > + > +// Chrome hang annotators. This can go away once BHR has completely replaced > +// ChromeHangs. > +static StaticAutoPtr<Observer::Annotators> gAnnotators; I know this is old code, but can we call this gChromehangAnnotators? @@ +53,5 @@ > + MOZ_COUNT_DTOR(BrowserHangAnnotations); > +} > + > +void > +BrowserHangAnnotations::AddAnnotation(const nsAString& aName, const int32_t aData) We still don't have any variant types other than nsIVariant? :( @@ +161,5 @@ > + return result; > +} > + > +bool > +BrowserHangAnnotations::GetEnumerator(HangAnnotations::Enumerator** aOutEnum) Does this method really need a return value + an out pointer? @@ +232,5 @@ > +{ > + BackgroundHangMonitor::RegisterAnnotator(aAnnotator); > + // We still register annotators for ChromeHangs > + if (NS_IsMainThread() && > + GeckoProcessType_Default == XRE_GetProcessType()) { don't we have chromehang reporting in child processes as well? @@ +236,5 @@ > + GeckoProcessType_Default == XRE_GetProcessType()) { > + if (!gAnnotators) { > + gAnnotators = new Observer::Annotators(); > + } > + gAnnotators->Register(aAnnotator); Is the return value of Annotators::Register used or going to be used anywhere?
Attachment #8569538 - Flags: review?(vdjeric) → review+
Comment on attachment 8566416 [details] [diff] [review] Part 3: Add annotation support to BHR Review of attachment 8566416 [details] [diff] [review]: ----------------------------------------------------------------- ::: xpcom/threads/BackgroundHangMonitor.cpp @@ +566,5 @@ > +BackgroundHangMonitor::RegisterAnnotator(HangMonitor::Annotator& aAnnotator) > +{ > +#ifdef MOZ_ENABLE_BACKGROUND_HANG_MONITOR > + BackgroundHangThread* thisThread = BackgroundHangThread::FindThread(); > + if (!thisThread) { just to make sure I understand.. if I want to provide annotations for compositor thread hangs, i have to call RegisterAnnotator from the compositor thread? if so, i think we'll want to add a "thread" argument in the future so RegisterAnnotator can be called from other threads
Attachment #8566416 - Flags: review?(nchen) → review+
^^ i did jim's review as jim is away for a while
(In reply to Vladan Djeric (:vladan) -- please needinfo! from comment #18) > Comment on attachment 8566416 [details] [diff] [review] > Part 3: Add annotation support to BHR > > Review of attachment 8566416 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: xpcom/threads/BackgroundHangMonitor.cpp > @@ +566,5 @@ > > +BackgroundHangMonitor::RegisterAnnotator(HangMonitor::Annotator& aAnnotator) > > +{ > > +#ifdef MOZ_ENABLE_BACKGROUND_HANG_MONITOR > > + BackgroundHangThread* thisThread = BackgroundHangThread::FindThread(); > > + if (!thisThread) { > > just to make sure I understand.. if I want to provide annotations for > compositor thread hangs, i have to call RegisterAnnotator from the > compositor thread? if so, i think we'll want to add a "thread" argument in > the future so RegisterAnnotator can be called from other threads Correct. Filed bug 1141284 to add this functionality.
Attached patch Part 2: Refactor hang annotations code (r4) (obsolete) (deleted) — Splinter Review
(In reply to Vladan Djeric (:vladan) -- please needinfo! from comment #17) > Comment on attachment 8569538 [details] [diff] [review] > Part 2: Refactor hang annotations code (r3) > > Review of attachment 8569538 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: xpcom/threads/HangAnnotations.cpp > @@ +16,5 @@ > > +namespace HangMonitor { > > + > > +// Chrome hang annotators. This can go away once BHR has completely replaced > > +// ChromeHangs. > > +static StaticAutoPtr<Observer::Annotators> gAnnotators; > > I know this is old code, but can we call this gChromehangAnnotators? > Sure. Done. > @@ +53,5 @@ > > + MOZ_COUNT_DTOR(BrowserHangAnnotations); > > +} > > + > > +void > > +BrowserHangAnnotations::AddAnnotation(const nsAString& aName, const int32_t aData) > > We still don't have any variant types other than nsIVariant? :( This is the best we have ATM. > > @@ +161,5 @@ > > + return result; > > +} > > + > > +bool > > +BrowserHangAnnotations::GetEnumerator(HangAnnotations::Enumerator** aOutEnum) > > Does this method really need a return value + an out pointer? Good point. We can just return nullptr upon failure. Fixed. > > @@ +232,5 @@ > > +{ > > + BackgroundHangMonitor::RegisterAnnotator(aAnnotator); > > + // We still register annotators for ChromeHangs > > + if (NS_IsMainThread() && > > + GeckoProcessType_Default == XRE_GetProcessType()) { > > don't we have chromehang reporting in child processes as well? This was added in bug 1087410. At that time chromehangs were not initialized in content processes. > > @@ +236,5 @@ > > + GeckoProcessType_Default == XRE_GetProcessType()) { > > + if (!gAnnotators) { > > + gAnnotators = new Observer::Annotators(); > > + } > > + gAnnotators->Register(aAnnotator); > > Is the return value of Annotators::Register used or going to be used > anywhere? It's not used yet, but I felt that it might be useful in the future.
Attachment #8569538 - Attachment is obsolete: true
Attachment #8574901 - Flags: review+
(In reply to Georg Fritzsche [:gfritzsche] [away Feb 27 - March 15] from comment #12) > As mentioned on IRC, i think this feature should get some basic test > coverage. > We could: > * fake a flash plugin (i.e. fake the mimetype etc. like > dom/plugins/test/testplugin/javaplugin/) > * run the plugin in a mochitest-chrome > * use plugin.stallPlugin() > * collect the telemetry payload and sanity check things Filed bug 1141331 for this.
Keywords: leave-open
Minor fix for static analysis failure
Attachment #8574901 - Attachment is obsolete: true
Attachment #8575020 - Flags: review+
Depends on: 1133521
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: