Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8ec6c86
note to disable ANR
NickKhalow May 18, 2026
0ba942d
integrate custom anr detector base
NickKhalow May 18, 2026
6292fe6
CurrentCallStack mock + stringbuilder
NickKhalow May 18, 2026
b17c221
dump collection windows
NickKhalow May 19, 2026
f59823b
ship procdump
NickKhalow May 19, 2026
defa83d
editor button
NickKhalow May 19, 2026
8931c2b
archive and ensure file is written
NickKhalow May 19, 2026
465c653
extract collect and archive func
NickKhalow May 19, 2026
9c03ae2
collect info base64 of zip
NickKhalow May 19, 2026
0885277
anr commands for debug
NickKhalow May 19, 2026
6eabc83
Merge branch 'dev' into feat/anr-detection
NickKhalow May 19, 2026
787ed69
ci flags
NickKhalow May 19, 2026
8df9aea
meta files
NickKhalow May 19, 2026
d52668f
run collect and archive on background
NickKhalow May 19, 2026
04717a1
check sentry label
NickKhalow May 19, 2026
e5acd38
report sentry enabled in the logs
NickKhalow May 19, 2026
3ed573e
Merge branch 'dev' into feat/report-sentry-status
NickKhalow May 19, 2026
1500361
Merge remote-tracking branch 'origin/feat/report-sentry-status' into …
NickKhalow May 19, 2026
cf6ed92
format app args
NickKhalow May 19, 2026
330ff07
script-debugging flag
NickKhalow May 20, 2026
ba482e8
Merge remote-tracking branch 'origin/dev' into feat/ci-windows-only-a…
NickKhalow May 20, 2026
0268748
Merge branch 'dev' into feat/anr-detection
NickKhalow May 20, 2026
dab1bfc
add manual knob
NickKhalow May 20, 2026
94766a0
Merge remote-tracking branch 'origin/feat/ci-windows-only-and-macos-o…
NickKhalow May 20, 2026
a1bd4a7
Merge branch 'dev' into feat/anr-detection
NickKhalow May 20, 2026
9323184
upload path report
NickKhalow May 20, 2026
0815933
dcl process execute blocking
NickKhalow May 21, 2026
5cc00e0
execute blocking dcl anr
NickKhalow May 21, 2026
c5fb544
consider error code
NickKhalow May 21, 2026
d2455fc
fix enable options
NickKhalow May 21, 2026
d743fc1
report exception on command execute
NickKhalow May 21, 2026
fbe7ab2
initialize paths on main thread
NickKhalow May 21, 2026
c3d0657
windows file the dmp as an attachment
NickKhalow May 21, 2026
1bd55a6
remove debug logs
NickKhalow May 21, 2026
e928913
correctness validates
NickKhalow May 21, 2026
d857620
clarify comment
NickKhalow May 21, 2026
09cdca5
fix handle dispose
NickKhalow May 21, 2026
4b3a988
Merge branch 'dev' into feat/anr-detection
NickKhalow May 21, 2026
b931077
minidump collect via native api
NickKhalow May 21, 2026
0b36fd6
fix typo
NickKhalow May 21, 2026
03a5cb7
Merge branch 'feat/anr-detection' of github.com:decentraland/unity-ex…
NickKhalow May 21, 2026
7ae4c26
load in editor for testing
NickKhalow May 21, 2026
1875239
strip procdump down
NickKhalow May 21, 2026
870808a
remove redundant code
NickKhalow May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 53 additions & 6 deletions .github/workflows/build-unitycloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ on:
required: false
type: boolean
default: false
script_debugging:
description: 'Enable Script Debugging (forces Development build)'
required: false
type: boolean
default: false
delta_threshold_macos_mb:
description: 'Warn if macOS growth > this MB (0 = off)'
required: false
Expand Down Expand Up @@ -112,6 +117,10 @@ on:
required: false
type: boolean
default: false
script_debugging:
required: false
type: boolean
default: false
is_release_build:
type: boolean
required: false
Expand Down Expand Up @@ -336,13 +345,20 @@ jobs:
run: |
#!/bin/bash

if [[ "${{ github.event.inputs.sentry_enabled || inputs.sentry_enabled }}" == "true" ]]; then
sentry_enabled="${{ github.event.inputs.sentry_enabled || inputs.sentry_enabled }}"

if [[ "$sentry_enabled" != "true" && "${{ github.event_name }}" == "pull_request" ]]; then
echo "Checking PR labels: ${{ join(github.event.pull_request.labels.*.name, ', ') }}"
sentry_enabled=$(echo "${{ join(github.event.pull_request.labels.*.name, ' ') }}" | grep -qw 'enable-sentry' && echo true || echo false)
fi

if [[ "$sentry_enabled" == "true" ]]; then
if [[ "${{ inputs.is_release_build }}" == "true" ]]; then
echo "environment=production" >> "$GITHUB_OUTPUT"
else
echo "environment=development" >> "$GITHUB_OUTPUT"
fi

echo "upload_symbols=true" >> "$GITHUB_OUTPUT"
echo "sentry_enabled=true" >> "$GITHUB_OUTPUT"
else
Expand Down Expand Up @@ -420,6 +436,22 @@ jobs:
options+=("EnableDeepProfilingSupport")
fi

# Script Debugging: input toggle (workflow_dispatch / workflow_call) or 'script-debugging' PR label.
# AllowDebugging requires a Development build to be honored by Unity.
script_debugging="${{ github.event.inputs.script_debugging || inputs.script_debugging }}"

if [[ "$script_debugging" != "true" && "${{ github.event_name }}" == "pull_request" ]]; then
script_debugging=$(echo "${{ join(github.event.pull_request.labels.*.name, ' ') }}" | grep -qw 'script-debugging' && echo true || echo false)
fi

if [[ "$script_debugging" == "true" ]]; then
# Add Development only if not already added by profile mode
if [[ ! " ${options[*]} " =~ " Development " ]]; then
options+=("Development")
fi
options+=("AllowDebugging")
fi

# Write the array as a comma-separated string
# Set the Internal Field Separator to comma
IFS=,
Expand Down Expand Up @@ -796,21 +828,36 @@ jobs:
*) echo "BUILD_PREFIX=gn" >> $GITHUB_ENV ;;
esac

- name: Compute S3 destination path
env:
RESOLVED_DESTINATION_PATH: "${{
inputs.is_release_build && format('@dcl/{0}/releases/{1}', github.event.repository.name, inputs.tag_version)
|| format('@dcl/{0}/branch/{1}/{2}-{3}-{4}', github.event.repository.name, env.SAFE_BRANCH_NAME, env.BUILD_PREFIX, github.run_number, env.SHA_SHORT)
}}"
run: |
echo "DESTINATION_PATH=${RESOLVED_DESTINATION_PATH}" >> $GITHUB_ENV

- name: Upload artifact to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.EXPLORER_TEAM_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.EXPLORER_TEAM_AWS_SECRET_ACCESS_KEY }}
EXPLORER_TEAM_S3_BUCKET: ${{ secrets.EXPLORER_TEAM_S3_BUCKET }}
DESTINATION_PATH: "${{
inputs.is_release_build && format('@dcl/{0}/releases/{1}', github.event.repository.name, inputs.tag_version)
|| format('@dcl/{0}/branch/{1}/{2}-{3}-{4}', github.event.repository.name, env.SAFE_BRANCH_NAME, env.BUILD_PREFIX, github.run_number, env.SHA_SHORT)
}}"
run: |
npx @dcl/cdn-uploader@next \
--bucket $EXPLORER_TEAM_S3_BUCKET \
--local-folder upload_to_s3 \
--bucket-folder $DESTINATION_PATH

- name: Print S3 upload URL
run: |
ARTIFACT_URL="https://explorer-artifacts.decentraland.org/${DESTINATION_PATH}/${{ env.artifact_name }}.zip"
echo "::notice::Artifact uploaded to: ${ARTIFACT_URL}"
{
echo "### Artifact upload URL (${{ matrix.target }})"
echo
echo "[${ARTIFACT_URL}](${ARTIFACT_URL})"
} >> "$GITHUB_STEP_SUMMARY"

- name: Upload debug symbols
uses: actions/upload-artifact@v4
with:
Expand Down
29 changes: 29 additions & 0 deletions Explorer/Assets/DCL/Chat/Commands/AnrDumpChatCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#if UNITY_STANDALONE_WIN
using Cysharp.Threading.Tasks;
using DCL.Diagnostics.Sentry;
using RichTypes;
using System.Threading;
using Cysharp.Threading.Tasks;

namespace DCL.Chat.Commands
{
public class AnrDumpChatCommand : IChatCommand
{
public string Command => "anr-dump";
public string Description => "<b>/anr-dump</b>\n Collect and archive a process dump to the app directory";
public bool DebugOnly => true;

public async UniTask<string> ExecuteCommandAsync(string[] parameters, CancellationToken ct)
{
Result<(string filePath, string zipPath)> result = default;
{
await using var _ = await global::Utility.Multithreading.ExecuteOnThreadPoolScope.NewScopeAsync();
result = ThreadsDumpUtility.CollectAndArchiveDumpInfoToAppDir();
}

if (result.Success == false) return $"Dump failed: {result.ErrorMessage}";
return $"Dump collected:\n {result.Value.filePath}\n {result.Value.zipPath}";
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Explorer/Assets/DCL/Chat/Commands/AnrSimulateChatCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Cysharp.Threading.Tasks;
using System.Globalization;
using System.Threading;

namespace DCL.Chat.Commands
{
public class AnrSimulateChatCommand : IChatCommand
{
private const int DEFAULT_FREEZE_MS = 10_000;

public string Command => "anr-simulate";
public string Description => "<b>/anr-simulate <i>[ms]</i></b>\n Freeze the main thread to trigger ANR detection";
public bool DebugOnly => true;

public bool ValidateParameters(string[] parameters) =>
parameters.Length == 0 || (parameters.Length == 1 && int.TryParse(parameters[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out _));

public UniTask<string> ExecuteCommandAsync(string[] parameters, CancellationToken ct)
{
int freezeMs = DEFAULT_FREEZE_MS;

if (parameters.Length == 1)
int.TryParse(parameters[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out freezeMs);

Thread.Sleep(freezeMs);

return UniTask.FromResult($"Main thread was frozen for {freezeMs} ms.");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Linq;
using System.Threading;
using Utility;
using DCL.Diagnostics;

namespace DCL.Chat.MessageBus
{
Expand Down Expand Up @@ -69,7 +70,11 @@ private async UniTaskVoid HandleChatCommandAsync(ChatChannel.ChannelId channelId
string response = await command.ExecuteCommandAsync(parameters, commandCts.Token);
SendFromSystem(channelId, channelType, response);
}
catch (Exception) { SendFromSystem(channelId, channelType, "🔴 Error running command."); }
catch (Exception e)
{
SendFromSystem(channelId, channelType, "🔴 Error running command.");
ReportHub.LogError(ReportCategory.UNSPECIFIED, $"Error running command: {e}");
}

return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,16 @@ private void LogArguments()
var sb = new StringBuilder(COUNT_PER_LINE * appParameters.Count);
var count = 1;

sb.AppendLine("==================");
sb.AppendLine("Application arguments:");
sb.AppendLine("==================\n");

foreach ((string? key, string? value) in appParameters)
{
sb.Append("Arg ").Append(count).Append(": ").Append(key).Append(" = ").Append(value).Append("\n");
count++;
}
sb.AppendLine("==================\n");

ReportHub.LogProductionInfo(sb.ToString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ await MapRendererContainer
new SceneAdminsChatCommand(),
new AppArgsCommand(appArgs),
new LogMatrixChatCommand((RuntimeReportsHandlingSettings)bootstrapContainer.DiagnosticsContainer.Settings),
new AnrSimulateChatCommand(),
#if UNITY_STANDALONE_WIN
new AnrDumpChatCommand(),
#endif
};

chatCommands.Add(new HelpChatCommand(chatCommands, appArgs));
Expand Down
6 changes: 4 additions & 2 deletions Explorer/Assets/DCL/Infrastructure/Utility/Utility.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"GUID:9887bf5401cdc9140916d3edbea10b69",
"GUID:ba053ae967dabc94a811350e36a486f3",
"GUID:3c7b57a14671040bd8c549056adc04f5",
"GUID:2efe6c760f205482eb96395a31bb7036"
"GUID:2efe6c760f205482eb96395a31bb7036",
"GUID:1087662aaf1c5462baa91fb9484296fd",
"GUID:75edf6fa50ff464395ca31529ea14d25"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -36,4 +38,4 @@
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ public static void LogSystem(string version)
stringBuilder.AppendFormat("Window Mode: {0}\n", Screen.fullScreenMode.ToString());
AppendFooter(stringBuilder);

AppendHeader(stringBuilder, "SENTRY");
stringBuilder.AppendFormat("Enabled: {0}\n", SentrySdk.IsEnabled);
SentryUnityOptions? sentryOptions = ScriptableSentryUnityOptions.LoadSentryUnityOptions();
if (sentryOptions != null)
{
stringBuilder.AppendFormat("Environment: {0}\n", sentryOptions.Environment ?? "<unset>");
stringBuilder.AppendFormat("Release: {0}\n", sentryOptions.Release ?? "<unset>");
stringBuilder.AppendFormat("DSN: {0}\n", string.IsNullOrEmpty(sentryOptions.Dsn) ? "<unset>" : "<set>");
}
AppendFooter(stringBuilder);

ReportHub.LogProductionInfo(stringBuilder.ToString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace DCL.Diagnostics.Sentry
{
public class DclApplicationNotRespondingException : Exception
{
#if UNITY_STANDALONE_WIN
public readonly string? DumpFilePath;

internal DclApplicationNotRespondingException(string message, string? dumpFilePath) : base(message)
{
this.DumpFilePath = dumpFilePath;
}
#else
internal DclApplicationNotRespondingException(string message) : base(message) { }
#endif
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading