Skip to content

Hot reload on Android: Mono SIGSEGV in mono_image_load_enc_delta when a ctor parameter order changes #3250

Open

Description

@kazo0

What

On the Android emulator (API 34, Mono interpreter, Debug), the app crashed natively while applying a hot-reload delta during Navigation.UI.Tests.Given_Navigation_HotReload.When_VmCtorParamOrderChangedViaHR_Then_NewInstanceReflectsUpdate. That test swaps the order of a view-model's constructor parameters (HotReloadParamOrderTarget.cs).

Build 239790 (#3238), second app launch (Given_Navigation_HotReload alone, fresh process), 197s into the process:

F libc  : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 2550 (ns.RuntimeTests)
F DEBUG : Cause: null pointer dereference
F DEBUG : backtrace:
F DEBUG :   #00 pc 00000000001b9431  .../lib/x86_64/libmonosgen-2.0.so
F DEBUG :   #01 pc 0000000000009c41  .../lib/x86_64/libmono-component-hot_reload.so
F DEBUG :   #02 pc 0000000000278db7  .../lib/x86_64/libmonosgen-2.0.so (mono_image_load_enc_delta+55)
F DEBUG :   #03 pc 0000000000246389  .../lib/x86_64/libmonosgen-2.0.so
F DEBUG :   #04 pc 0000000000001ca9  <anonymous:5ec5e000>

The last page loaded before the crash was HotReloadParamOrderPage; the DevServer had just produced a delta ("Found 2 metadata updates").

Intermittent

The same test passed in the previous two Android CI runs of this class (builds 239758 and 239767), and on a local API 36 emulator. One crash in three CI runs so far.

Real-world impact

A developer who reorders constructor parameters while hot reloading on Android can have their app crash instead of getting a "restart required" message. The fault is inside Mono's hot-reload component, so this is likely a dotnet/runtime bug: the runtime should reject an unsupported delta, not segfault.

Work

  • Reproduce locally: apply/revert the HotReloadParamOrderTarget.cs edit in a loop on an emulator until it crashes, and capture the tombstone with symbols (adb pull /data/tombstones).
  • Check the delta the DevServer produces for this edit: a parameter reorder should be a rude edit, or a supported "update parameters" edit depending on the runtime's capabilities. If the DevServer sends a delta Mono can't apply, that's a DevServer bug; if the delta is valid, it's a runtime bug.
  • Report upstream (dotnet/runtime for Mono, or unoplatform/uno for the DevServer) with the repro.
  • Remove the exclusion from AndroidTestFilters in build/ci/stage-runtime-tests-mobile-hotreload.yml.

Related: #3243 (Mono BadImageFormatException after many deltas in one process), #3238 (the lanes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/navigationkind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions