Skip to content

Commit ea01f0a

Browse files
Bug 1386760 - Remove the ExecutableName annotation r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D27885 --HG-- extra : moz-landing-system : lando
1 parent e545110 commit ea01f0a

File tree

3 files changed

+18
-51
lines changed

3 files changed

+18
-51
lines changed

toolkit/crashreporter/CrashAnnotations.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,6 @@ EventLoopNestingLevel:
273273
type: integer
274274
ping: true
275275

276-
ExecutableName:
277-
description: >
278-
The name of the last executable that was launched via the nsIProcess class.
279-
Multiple executables can be launched at the same time from one or more
280-
threads so this annotation might not always contain the correct value. To
281-
be removed once bug 1386760 is fixed.
282-
type: string
283-
284276
ExpectedStreamLen:
285277
description: >
286278
Expected length of an IPC proxy stream.

xpcom/threads/nsProcess.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class nsProcess final : public nsIProcess, public nsIObserver {
4646
private:
4747
~nsProcess();
4848
static void Monitor(void* aArg);
49-
static void RemoveExecutableCrashAnnotation();
5049
void ProcessComplete();
5150
nsresult CopyArgsAndRunProcess(bool aBlocking, const char** aArgs,
5251
uint32_t aCount, nsIObserver* aObserver,
@@ -57,7 +56,6 @@ class nsProcess final : public nsIProcess, public nsIObserver {
5756
// The 'args' array is null-terminated.
5857
nsresult RunProcess(bool aBlocking, char** aArgs, nsIObserver* aObserver,
5958
bool aHoldWeak, bool aArgsUTF8);
60-
void AddExecutableCrashAnnotation();
6159

6260
PRThread* mThread;
6361
mozilla::Mutex mLock;

xpcom/threads/nsProcessCommon.cpp

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "mozilla/ArrayUtils.h"
1616

1717
#include "nsCOMPtr.h"
18-
#include "nsExceptionHandler.h"
1918
#include "nsAutoPtr.h"
2019
#include "nsMemory.h"
2120
#include "nsProcess.h"
@@ -246,7 +245,19 @@ void nsProcess::Monitor(void* aArg) {
246245
exitCode = -1;
247246
}
248247
}
249-
#elif defined(XP_UNIX)
248+
249+
// Lock in case Kill or GetExitCode are called during this
250+
{
251+
MutexAutoLock lock(process->mLock);
252+
CloseHandle(process->mProcess);
253+
process->mProcess = nullptr;
254+
process->mExitValue = exitCode;
255+
if (process->mShutdown) {
256+
return;
257+
}
258+
}
259+
#else
260+
# ifdef XP_UNIX
250261
int exitCode = -1;
251262
int status = 0;
252263
pid_t result;
@@ -260,30 +271,25 @@ void nsProcess::Monitor(void* aArg) {
260271
exitCode = 256; // match NSPR's signal exit status
261272
}
262273
}
263-
#else
274+
# else
264275
int32_t exitCode = -1;
265276
if (PR_WaitProcess(process->mProcess, &exitCode) != PR_SUCCESS) {
266277
exitCode = -1;
267278
}
268-
#endif
269-
270-
// The application has finished executing once we reach this point
271-
RemoveExecutableCrashAnnotation();
279+
# endif
272280

273281
// Lock in case Kill or GetExitCode are called during this
274282
{
275283
MutexAutoLock lock(process->mLock);
276-
#if defined(PROCESSMODEL_WINAPI)
277-
CloseHandle(process->mProcess);
278-
#endif
279-
#if !defined(XP_UNIX)
284+
# if !defined(XP_UNIX)
280285
process->mProcess = nullptr;
281-
#endif
286+
# endif
282287
process->mExitValue = exitCode;
283288
if (process->mShutdown) {
284289
return;
285290
}
286291
}
292+
#endif
287293

288294
// If we ran a background thread for the monitor then notify on the main
289295
// thread
@@ -541,8 +547,6 @@ nsresult nsProcess::RunProcess(bool aBlocking, char** aMyArgv,
541547
mPid = ptrProc->pid;
542548
#endif
543549

544-
AddExecutableCrashAnnotation();
545-
546550
NS_ADDREF_THIS();
547551
mBlocking = aBlocking;
548552
if (aBlocking) {
@@ -580,33 +584,6 @@ nsProcess::GetIsRunning(bool* aIsRunning) {
580584
return NS_OK;
581585
}
582586

583-
void nsProcess::AddExecutableCrashAnnotation() {
584-
#if defined(XP_WIN)
585-
nsAutoCString executableName;
586-
if (NS_FAILED(mExecutable->GetNativeLeafName(executableName))) {
587-
return;
588-
}
589-
590-
// The following executables might be launched during shutdown and lead to a
591-
// shutdown hang. We're adding this annotation to try and detect which is the
592-
// culprit of bug 1386760
593-
if (executableName.EqualsLiteral("minidump-analyzer.exe") ||
594-
executableName.EqualsLiteral("pingsender.exe") ||
595-
executableName.EqualsLiteral("updater.exe")) {
596-
CrashReporter::AnnotateCrashReport(
597-
CrashReporter::Annotation::ExecutableName, executableName.get());
598-
}
599-
#endif // defined(XP_WIN)
600-
}
601-
602-
/* static */
603-
void nsProcess::RemoveExecutableCrashAnnotation() {
604-
#if defined(XP_WIN)
605-
CrashReporter::RemoveCrashReportAnnotation(
606-
CrashReporter::Annotation::ExecutableName);
607-
#endif // defined(XP_WIN)
608-
}
609-
610587
NS_IMETHODIMP
611588
nsProcess::GetStartHidden(bool* aStartHidden) {
612589
*aStartHidden = mStartHidden;

0 commit comments

Comments
 (0)