Skip to content

[android] Fix flaky Android memory consumption measurements #4826

Open
@matouskozak

Description

@matouskozak

We're seeing occasional crashes (locally and on CI) in Android memory consumption measurements

<HelixWorkItem Include="@(MAUIAndroidScenario -> 'Memory Consumption - %(Identity)')" Condition="!$(HelixTargetQueue.ToLowerInvariant().Contains('galaxy'))">
<PreCommands>echo on; xcopy %HELIX_CORRELATION_PAYLOAD%\$(PreparePayloadOutDirectoryName)\%(HelixWorkItem.ScenarioDirectoryName) %HELIX_WORKITEM_ROOT%\pub\ /E /I /Y</PreCommands>
<Command>$(Python) test.py devicememoryconsumption --device-type android --package-path pub\%(HelixWorkItem.ApkName).apk --package-name %(HelixWorkItem.PackageName) --scenario-name &quot;%(Identity)&quot; --runtime 30 --test-iteration 2 $(ScenarioArgs)</Command>
</HelixWorkItem>

Error message:

Traceback (most recent call last):
  File "D:\h\w\B9F509E3\w\ADFB098F\e\test.py", line 16, in <module>
    Runner(traits).run()
  File "D:\h\w\B9F509E3\p\shared\runner.py", line 482, in run
    raise Exception("Failed to capture the reported start time!")
Exception: Failed to capture the reported start time!

raised at

raise Exception("Failed to capture the reported start time!")

This is because the memory tracing isn't properly reporting the measured values:

[2025/04/10 06:53:55][INFO] Process summary:
[2025/04/10 06:53:55][INFO]   * com.companyname.mauiandroiddefault / u0a889 / v1:
[2025/04/10 06:53:55][INFO]          TOTAL: 99%
[2025/04/10 06:53:55][INFO]            Top: 99%

instead of

[2025/04/10 06:39:50][INFO] Process summary:
[2025/04/10 06:39:50][INFO]   * com.companyname.mauiandroiddefault / u0a4437 / v1:
[2025/04/10 06:39:50][INFO]          TOTAL: 99% (128MB-128MB-128MB/123MB-123MB-123MB/227MB-227MB-227MB over 1)
[2025/04/10 06:39:50][INFO]            Top: 99% (128MB-128MB-128MB/123MB-123MB-123MB/227MB-227MB-227MB over 1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ScenariobugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions