Open Bug 1290357 Opened 3 years ago Updated 11 months ago

[mozcrash] Add logging for uptime of the application

Categories

(Testing :: Mozbase, defect, P3)

Version 3
defect

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

Details

It would be great to know how long the application was already running since a crash happened. With that information we could determine if it is a startup crash (application run time <60s).

Ted, would that be possible? I hope so.
Flags: needinfo?(ted)
Yes, we already record that information in the .extra file. I don't think mozcrash currently parses the .extra file, but it's not a very complicated format. If you look at one you'll find:
CrashTime=1431997333
StartupTime=1431945302

Those are both timestamps, so you can calculate (CrashTime - StartupTime) to get uptime in seconds.
Flags: needinfo?(ted)
Strange when I run the latest code locally via:

> $ python mozcrash/mozcrash.py /mozilla/code/gecko/ None

The output I see is the following:

> Crash reason:  SIGSEGV
> Crash address: 0x0
> Process uptime: not available

So we already have the process uptime as part of the output from minidump_stackwalk. Not sure why I do not see that on Treeherder for crashes. Maybe we had this feature at one point but removed it? The version I have is a bit old:

> -rwxr-xr-x 1 henrik henrik 1729752 Mar  7 15:33 /mozilla/bin/minidump_stackwalk

If that is not what you have in mind please let me know. But adding content via mozcrash to the process crash output from minidump especially at specific lines doesn't seem to be that easy.
Flags: needinfo?(ted)
(In reply to Henrik Skupin (:whimboo) from comment #3)
> Strange when I run the latest code locally via:
> 
> > $ python mozcrash/mozcrash.py /mozilla/code/gecko/ None
> 
> The output I see is the following:
> 
> > Crash reason:  SIGSEGV
> > Crash address: 0x0
> > Process uptime: not available
> 
> So we already have the process uptime as part of the output from
> minidump_stackwalk. Not sure why I do not see that on Treeherder for
> crashes. Maybe we had this feature at one point but removed it? The version
> I have is a bit old:

That output was added in upstream Breakpad in 2014:
https://chromium.googlesource.com/breakpad/breakpad/+/63919583ba0d302a2ceb437ecf41a7975f44f54b%5E%21/#F7

It only shows up if certain information is present in the minidump though, and it's possible that Breakpad doesn't write that information on all platforms.

Note that as of recently we also have a "StartupCrash" annotation in the .extra file: bug 1295934.
Flags: needinfo?(ted)
So what would you prefer then? Should we add those extra lines to the stackwalk_output array right before the output from minidump_stackwalk? If we do it afterward it won't be that recognizable. Or should we inject those lines as mentioned above right behind the block starting with "Crash reason".
Flags: needinfo?(ted)
Printing it before the minidump_stackwalk output seems fine. I wouldn't try to inject it into the middle of the stackwalk output, that's confusing.
Flags: needinfo?(ted)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.