-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
frontend: Add automatic crash log upload after crashes for Windows and macOS #11943
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
11f0370
to
e952d18
Compare
This comment was marked as outdated.
This comment was marked as outdated.
No that's intended - the requirement was that no further popups should be displayed to the user as we already have too many of those. Using the menu entry to get at that same URL was the proposed solution. |
Edit: I see this is covered in the original description; duplicate uploads don't happen if the 'most recent detected crash log' has not changed. I do think it's a bit weird to have the redundancy of the checkbox if, no matter what, the Help menu is still required to yield the URL of the uploaded log. |
As I said, that's by design, maybe @Warchamp7 can chime in here as that was the solution we ended up with here. The basic idea is to lower the barrier for crash reports to be uploaded, particularly as this would allow automatic analysis of "current crashes" server-side without the manual input by users. |
Got it; yeah, if part of the idea here is 'eventual server-side processing' then I think that makes sense enough to me. |
e952d18
to
cc670f9
Compare
Removed the intro text for every upload on macOS to upload the unchanged JSON contents of the crash log to the server. That way the file can be downloaded and parsed/opened directly (albeit with a possible change of file suffix) in Xcode or Console. |
Added an experimental change for testers: Instead of relying on the class destructors, both Per Qt, slots connected to signals are executed in the order they are added, so adding |
63a6ee9
to
0de9c34
Compare
I haven't had a chance to review this, but I might eventually prefer the migration to |
Both have to be added at the same time. Otherwise plugin shutdown happens after the CrashHandler has been shut down and thus any 3rd party plugin could introduce an unclean shutdown and thus we could not provide the "safe mode" as a fix against that misbehaving 3rd party plugin. So it's either both or none of the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from my testing. One minor nit regarding wording.
Also discussed with Pat off-thread of having the upload checkbox hidden when the crash report in question has been previously uploaded.
8fe543c
to
c4505e1
Compare
Made the following substantial changes based on feedback:
|
The CrashHandler class encapsulates all functionality around unsafe shutdown detection as well as crash log discovery and log upload. Each (functional) CrashHandler should be initialized with an app launch UUID, which enables the handler to disambiguate a sentinel file for the current app launch from those of prior app launches.
This is an extended variant of the prior OBSLogReply class. The major change is that the dialog encapsulates the interface workflow for log uploads, including the confirmation for an upload and handling successful or unsuccessful uploads.
Updates include: * Use of CrashHandler to provide automatic uploads of the most recent crash log if an unclean shutdown was detected and it has not been uploaded yet. * Detection and handling of unclean shutdowns is delegated entirely to the CrashHandler class * Use of OBSLogReply has been replaced with the LogUploadDialog, which asks for confirmation before new uploads of log files (confirmation is skipped for files with available upload URLs already - only available for crash logs with this change) Architectural changes: * OBSApp is the layer responsible for application launch and shutdown states, as well as crash logs and application logs * The actual handling is delegated to purpose-made classes which OBSApp owns instances of * OBSBasic in turn refers to OBSApp for all this functionality, and can subscribe/connect to appropriate events exposed by OBSApp to this purpose * Implementation details (like the existence of the CrashHandler class) are not exposed to OBSBasic or the LogUploadDialog The amount of changes for normal log file upload have been purposefully limited. A proper refactoring of the application log file handling will move this code out of OBSBasic as well.
c4505e1
to
290bc5a
Compare
Description
This PR refactors the current safe mode implementation to allow automatic uploading of the most recent crash report upon a detected crash while avoiding duplicate uploads and also enables the feature on macOS.
Motivation and Context
The primary ask for this work was to enable the automatic upload of crash reports after OBS Studio has crashed and also enable this functionality to more platforms than just Windows.
Note
An even better solution towards this goal would be to use separate minimal process that uses platform-specific methods to "attach" to the main process and be able to detect and react to a crash and thus offer to relaunch the application and uploading a crash log from within it itself. That kind of solution was out of scope for this first iterative step.
To that end the following changes have been implemented:
CrashHandler
class.CrashHandler
,OBSApp
, andOBSBasic
has been decoupled and has been replaced by Qt signals which code can connect to and react accordinglyCrashHandler
class to distinguish between a "live" sentinel for the currently running instance versus an "old" sentinel, which would represent an unclean prior shutdownPlatform differences
On Windows the existing custom crash log files are checked and used for crash log upload.
Changes: The
CrashHandler
class will look for the most recent file by actual creation date and not simply by the time code in its file name anymore.On macOS the diagnostics reports generated by the operating system are used. No custom crash files are involved. As macOS "retires" active crash reports after some time, the subdirectory for retired reports is also taken into account when looking for a "most recent" crash, with the file creation date used for sorting the results.
On Linux and FreeBSD no searches for crash reports take place, the class methods are implemented as stubs to ensure the class implementation is complete on these platforms.
How Has This Been Tested?
Created custom crash logs in the locations used for macOS and Windows and checked that most recent crashes are found and uploaded from these locations accordingly.
url
field (error message was displayed)Types of changes
Checklist: