Skip to content

Commit a5c4dc9

Browse files
konraddysputkdysputjasoncdavis0vlussenburg
authored
Version 3.3.1 - native improvements (#59)
* Prevents from sending low memory warning to Backtrace when low memory warning occured. Let native integration handle it * Configurable OOM support * UI support + android improvements * Added code-review suggestions * Fixed line endings * Label improvements * Version bump * Changelog update * Date improvements * Update CHANGELOG.md * Removed not used code * Code improvements * Removed android specific attributes from BacktraceAttributes class * Fixed line endings * Update README.md * Update README.md * Update README.md * Update README.md * Clean ANR integration on application quit Co-authored-by: kdysput <konrad@DESKTOP-JHLN3EP.localdomain> Co-authored-by: jasoncdavis0 <jdavis@backtrace.io> Co-authored-by: Vincent Lussenburg <vlussenburg@users.noreply.github.com>
1 parent 7918bbc commit a5c4dc9

15 files changed

+186
-270
lines changed

Android/BacktraceAttributes.java

Lines changed: 0 additions & 166 deletions
This file was deleted.

Android/BacktraceAttributes.java.meta

Lines changed: 0 additions & 32 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Backtrace Unity Release Notes
22

3+
## Version 3.3.1
4+
- Improved Out-of-memory detection on iOS - Backtrace will report Out-of-memory exceptions when a memory warning occured and the application unexpectly closed. The Out-of-memory watcher will analyse game version, system version, debugger information and even more to determine if application closed by Out-of-memory exception or not.
5+
- Backtrace will no longer send low memory warnings reports from Android or iOS. Instead, Backtrace will utilize iOS OOM detection and extend the embedded native report attributes on Android.
6+
- Users can now enable or disable out-of-memory detection any time via UI/Backtrace API.
7+
38
## Version 3.3.0
49
- `BacktraceReport` stack trace now includes the file name of the stack frame.
510
- Performance improvements:

Editor/BacktraceClientConfigurationEditor.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public override void OnInspectorGUI()
2828
#endif
2929
#if UNITY_ANDROID || UNITY_IOS
3030
settings.HandleANR = EditorGUILayout.Toggle(BacktraceConfigurationLabels.LABEL_HANDLE_ANR, settings.HandleANR);
31+
settings.OomReports = EditorGUILayout.Toggle(BacktraceConfigurationLabels.LABEL_HANDLE_OOM, settings.OomReports);
3132
#endif
3233
settings.GameObjectDepth = EditorGUILayout.IntField(BacktraceConfigurationLabels.LABEL_GAME_OBJECT_DEPTH, settings.GameObjectDepth);
3334
}

Editor/BacktraceConfigurationEditor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public override void OnInspectorGUI()
4646
serializedObject.FindProperty("HandleANR"),
4747
new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_ANR));
4848

49+
EditorGUILayout.PropertyField(
50+
serializedObject.FindProperty("OomReports"),
51+
new GUIContent(BacktraceConfigurationLabels.LABEL_HANDLE_OOM));
52+
4953
#if UNITY_2019_2_OR_NEWER && UNITY_ANDROID
5054
EditorGUILayout.PropertyField(
5155
serializedObject.FindProperty("SymbolsUploadToken"),

Editor/BacktraceConfigurationLabels.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ internal static class BacktraceConfigurationLabels
1010
internal static string LABEL_DESTROY_CLIENT_ON_SCENE_LOAD = "Destroy client on new scene load (false - Backtrace managed)";
1111
internal static string LABEL_SAMPLING = "Log random sampling rate";
1212
internal static string LABEL_HANDLE_ANR = "Handle ANR (Application not responding)";
13+
#if UNITY_ANDROID || UNITY_IOS
14+
internal static string LABEL_HANDLE_OOM =
15+
#if UNITY_ANDROID
16+
"(Early access) Send Low memory warnings to Backtrace";
17+
#elif UNITY_IOS
18+
"(Early access) Send Out of memory exceptions to Backtrace";
19+
#endif
20+
#endif
1321
internal static string CAPTURE_NATIVE_CRASHES = "Capture native crashes";
1422
internal static string LABEL_REPORT_FILTER = "Filter reports";
1523
internal static string LABEL_NUMBER_OF_LOGS = "Collect last n game logs";
1624
internal static string LABEL_GAME_OBJECT_DEPTH = "Game object depth limit";
1725
internal static string LABEL_IGNORE_SSL_VALIDATION = "Ignore SSL validation";
18-
internal static string LABEL_SEND_UNHANDLED_GAME_CRASHES_ON_STARTUP= "Send unhandled native game crashes on startup";
26+
internal static string LABEL_SEND_UNHANDLED_GAME_CRASHES_ON_STARTUP = "Send unhandled native game crashes on startup";
1927
internal static string LABEL_USE_NORMALIZED_EXCEPTION_MESSAGE = "Use normalized exception message";
2028
internal static string LABEL_PERFORMANCE_STATISTICS = "Enable performance statistics";
2129
internal static string LABEL_SYMBOLS_UPLOAD_TOKEN = "Symbols upload token";
@@ -35,6 +43,5 @@ internal static class BacktraceConfigurationLabels
3543
internal static string LABEL_RETRY_LIMIT = "Maximum retries";
3644
internal static string LABEL_RETRY_ORDER = "Retry order (FIFO/LIFO)";
3745

38-
3946
}
4047
}

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- [Prerequisites](#prerequisites)
1313
- [Platforms Supported](#platforms-supported)
1414
- [Setup](#installation)
15-
- [Best Practices](#plugin-best-practices)
15+
- [Plugin Best Practices](#plugin-best-practices)
1616
- [Android Specific information](#android-specific-information)
1717
- [iOS Specific information](#ios-specific-information)
1818
- [Data Privacy](#data-privacy)
@@ -27,10 +27,12 @@
2727

2828
//Read from manager BacktraceClient instance
2929
var backtraceClient = GameObject.Find("_Manager").GetComponent<BacktraceClient>();
30-
try{
30+
try
31+
{
3132
//throw exception here
3233
}
33-
catch(Exception exception){
34+
catch(Exception exception)
35+
{
3436
var report = new BacktraceReport(exception);
3537
backtraceClient.Send(report);
3638
}
@@ -70,8 +72,8 @@ Web - WebGL
7072
Game Consoles - PlayStation4, Xbox One, Nintendo Switch
7173
There are some differences in capabilities that backtrace-unity provides based on the platform. Major capabilities are summarized as follows:
7274
* All Platforms - Errors, Unhandled Exceptions, Handled Exceptions, Custom Indexable Metadata, File Attachments*, Last N Log Lines, Automatic attachment of Screenshots, Client Side Deduplication Rules*, Client Side Submission Filtering, Client Side Submission Limits, Performance Diagnostics, Offline Database*(Except Nintendo Switch)
73-
* Android -Identified by attribute `uname.sysname` = Android; ANRs (Hangs), Native Process and Memory Information, Java Exception Handler (Plugins, Exported Game in Android Studio), NDK crashes.
74-
* iOS - Identified by attribute `uname.sysname` = IOS; ANRs (Hangs), Native Engine and Plugin Crashes.
75+
* Android -Identified by attribute `uname.sysname` = Android; ANRs (Hangs), Native Process and Memory Information, Java Exception Handler (Plugins, Exported Game in Android Studio), NDK crashes, low memory warnings.
76+
* iOS - Identified by attribute `uname.sysname` = IOS; ANRs (Hangs), Native Engine, Memory and Plugin Crashes.
7577
* WebGL - Identified by attribute `uname.sysname` = WebGL. The attribute device.model is currently used to share the browser information. Note that stacktraces for WebGL errors are only available if you choose to enable them in the Publishing Settings / Enable Exceptions drop down. More details [here](https://docs.unity3d.com/Manual/webgl-building.html)
7678
* Switch - Identified by attribute `uname.sysname` = Switch. Note that the attribute GUID is regenerated with each Switch restart (It is not an accurate count of number of Users or Devices. It is a count of Switch Sessions). Note that the current release does no support Offline Database or related features.
7779
* PlayStation4 - Identified by attribute `uname.sysname` = PS4
@@ -135,12 +137,13 @@ If you need to use more advanced configuration, `Initialize` method accepts a `B
135137

136138
# Plugin best practices
137139

138-
The plugin will report on 5 'classes' or errors:
140+
The plugin will report on 6 'classes' or errors:
139141
1) Log Errors - Programmers use [Debug.LogError](https://docs.unity3d.com/ScriptReference/Debug.LogError.html), a variant of Debug.Log, to log error messages to the console.
140142
2) Unhandled Exceptions - Unhandled Exceptions are exceptions in a game that occur outside of an explicit try / catch statement.
141143
3) Handled Exceptions - Exceptions that are explicitly caught and handled.
142144
4) Crashes - An end to the game play experience. The game crashes or restarts.
143-
5) Hangs - A game is non responsive. Some platforms will tell the user "This app has stopped responding"
145+
5) Hangs - A game is non responsive. Some platforms will tell the user “This app has stopped responding
146+
6) Low memory warning - A game is receiving signals from the OS that memory is under pressure or crashed under memory pressure.
144147

145148
The plugin provides 3 controls for managing what the client will report.
146149
- [SkipReports](#filtering-a-report) allows you to tell the client to only report on specific classes of these errors.
@@ -191,10 +194,11 @@ The backtrace-unity library includes support for capturing Android NDK crashes a
191194

192195
## ANRs and Hangs
193196

194-
When configuring the backtrace-unity client for an Android deployment, programmers will have a toggle available in backtrace-unity GUI in the Unity Editor to enable or disable ANR or Hang reports. This will use the default of 5 seconds. The `error.type` for these reports will be `Hang`.
197+
When configuring the backtrace-unity client for an Android deployment, programmers will have a toggle available in the backtrace-unity GUI in the Unity Editor to enable or disable ANR or Hang reports. This will use the default of 5 seconds. The `error.type` for these reports will be `Hang`.
198+
199+
## Low Memory Reports (Early Access)
195200

196-
## Low Memory Reports
197-
Backtrace can detect low memory situations for a game running in Unity on Android devices, and attempt to generate an error report with an associated dump object for further investigation. The `error.type` for these reports wiill be `Low Memory`.
201+
Backtrace can detect low memory situations for a game running in Unity on Android devices, and attempt to generate an error report with an associated dump object for further investigation. When configuring the backtrace-unity client for an Android deployment, programmers will have a toggle available in the backtrace-unity GUI in the Unity Editor to enable or disable sending Low memory warnings to Backtrace. The `error.type` for these reports wiill be `Low Memory`.
198202

199203
## Symbols upload
200204

@@ -219,13 +223,13 @@ The backtrace-unity library includes support for capturing native iOS crashes as
219223
system and vm usage related information including system.memory.free, system.memory.used, system.memory.total, system.memory.active, system.memory.inactive, system.memory.wired are avaialble.
220224

221225
## Hangs
222-
When configuring the backtrace-unity client for an iOS deployment, programmers will have a toggle available in backtrace-unity GUI in the Unity Editor to enable or disable ANR or Hang reports. This will use the default of 5 seconds. The `error.type` for these reports will be `Hang`.
226+
When configuring the backtrace-unity client for an iOS deployment, programmers will have a toggle available in the backtrace-unity GUI in the Unity Editor to enable or disable ANR or Hang reports. This will use the default of 5 seconds. The `error.type` for these reports will be `Hang`.
223227

224-
## Low Memory Reports
225-
Backtrace can detect low memory situations for a game running in Unity on iOS devices, and attempt to generate an error report with an associated dump object for further investigation. The `error.type` for these reports wiill be `Low Memory`.
228+
## Low Memory Reports (Early access)
229+
Backtrace can detect low memory situations for a game running in Unity on iOS devices, and attempt to generate an error report with an associated dump object for further investigation. When configuring the backtrace-unity client for an iOS deployment, programmers will have a toggle available in the backtrace-unity GUI in the Unity Editor to enable or disable sending Out of memory exceptions to Backtrace. The `error.type` for these reports wiill be `Low Memory`.
226230

227231
## Native Crashes
228-
When configuring the backtrace-unity client for an iOS deployment in the Unity Editor, programmers will have a toggle to enable or disable `Capture native crashes`. If this is enabled, the backtrace-unity client will ensure the crash report is generated, stored locally, and uploaded upon next game start. Unity crash reporter might prevent Backtrace Crash reporte from sending crashes to Backtrace. To be sure Backtrace is able to collect and send data please set "Enable CrashReport API" to false.
232+
When configuring the backtrace-unity client for an iOS deployment in the Unity Editor, programmers will have a toggle to enable or disable `Capture native crashes`. If this is enabled, the backtrace-unity client will ensure the crash report is generated, stored locally, and uploaded upon next game start. Unity crash reporter might prevent Backtrace Crash reporter from sending crashes to Backtrace. To be sure Backtrace is able to collect and send data please set "Enable CrashReport API" to false.
229233
![Enable symbols](./Documentation~/images/Disable-ios-unity-crash-reporter.png)
230234

231235
## Debug Symbol upload

0 commit comments

Comments
 (0)