sdk icon indicating copy to clipboard operation
sdk copied to clipboard

VM crash when debugging (watch)

Open marcglasberg opened this issue 2 years ago • 3 comments

The Flutter app crashes when I try to inspect (watch) a value with the debugger.

A simple way to reproduce this can be found here: https://github.com/marcglasberg/fast_immutable_collections/issues/42

By following the explanation there, I get this stack overflow:

F/libc    ( 7981): Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xbeb7fffc in tid 8010 (1.ui), pid 7981 (om.example.lixo)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86_arm:11/RSR1.201013.001/6903271:user/release-keys'
Revision: '0'
ABI: 'x86'
Timestamp: 2022-07-09 19:18:25-0300
pid: 7981, tid: 8010, name: 1.ui  >>> com.example.lixo <<<
uid: 10156
signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xbeb7fffc
Cause: stack pointer is close to top of stack; likely stack overflow.
    eax f000c8e0  ebx c0b99508  ecx bd708021  edx 0e72796a
    edi e910e670  esi beb801f0
    ebp beb80038  esp beb80000  eip c07dad5c
backtrace:
      #00 pc 01a52d5c  /data/app/~~OVWcmB6TUK24WdToinP3BA==/com.example.lixo-hY88Xz66MGjH6kgg_5qOHA==/lib/x86/libflutter.so (BuildId: c23393704a650677a4265da6e395517feaa5fa50)
      #01 pc 019ebc30  /data/app/~~OVWcmB6TUK24WdToinP3BA==/com.example.lixo-hY88Xz66MGjH6kgg_5qOHA==/lib/x86/libflutter.so (BuildId: c23393704a650677a4265da6e395517feaa5fa50)
      #02 pc 019eb5b3  /data/app/~~OVWcmB6TUK24WdToinP3BA==/com.example.lixo-hY88Xz66MGjH6kgg_5qOHA==/lib/x86/libflutter.so (BuildId: c23393704a650677a4265da6e395517feaa5fa50)
...

Environment is: Flutter (Channel stable, 3.0.4, on Microsoft Windows [Version 10.0.19044.1766], locale pt-BR)

I am the author of the https://pub.dev/packages/fast_immutable_collections package, and I was able to easily reproduce this.

There are 2 possibilities:

  • The Dart debugger has a bug; or
  • My package's IList class has a bug that is being triggered by the debugger. Note the IList is an Iterable, but it's not a List.

Could you please tell me what methods the debugger calls to create the watch?

In any case, the app shouldn't crash like this, in any circumstances. The debugger should catch the error and say something like "this object's inspection throws an error".

marcglasberg avatar Jul 09 '22 22:07 marcglasberg

Same issue without using fast_immutable_collections, unfortunately I don't have a minimal example that can reproduce the issue.

My problem goes away with the following versions:

  • Flutter 3.0.1
  • Flutter VS Code Extension 3.42.0
  • Dart VS Code Extension 3.42.1

The issue persists with Flutter 3.0.1 when Flutter and Dart extensions are on 3.44.0.

ozozozd avatar Jul 15 '22 09:07 ozozozd

To whom it is helpful: here is crash dump created with Flutter 3.0.5 on Android arm64 (host: macOS 12.5, VS Code with Flutter v3.46 and Dart v3.46.1 extensions):

https://pastebin.com/mKiADD2D

Is it created using these instructions.

sanderhyipyip avatar Aug 09 '22 11:08 sanderhyipyip

This might be fixed already by https://github.com/dart-lang/sdk/commit/6970e0907bf2cabe0d3e5da0846616d3ce972471.

If so, would it be feasible to port the fix to Dart 2.17?

sanderhyipyip avatar Aug 09 '22 12:08 sanderhyipyip

//cc @itsjustkevin there is a question about cherry picking a fix to the Dart 2.17 release. I would think we are very close to a Dart 2.18 stable release and maybe we could have the user upgrade to Dart 2.18.

a-siva avatar Aug 18 '22 20:08 a-siva

@a-siva There is a bit of risk in cherry-picking this late into the cycle. Is this a major issue that needs to be taken care of now or can it wait for a stable hotfix?

itsjustkevin avatar Aug 18 '22 23:08 itsjustkevin

@itsjustkevin the user was asking about cherry picking into the Dart 2.17 release. The fix already exists in Dart 2.18

a-siva avatar Aug 19 '22 00:08 a-siva

@athomas is it reasonable to do a stable and beta hotfix next week?

itsjustkevin avatar Aug 19 '22 12:08 itsjustkevin

Yes, we can do that.

On Fri, 19 Aug 2022, 14:51 Kevin Chisholm, @.***> wrote:

@athomas https://github.com/athomas is it reasonable to do a stable and beta hotfix next week?

— Reply to this email directly, view it on GitHub https://github.com/dart-lang/sdk/issues/49430#issuecomment-1220639779, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYRJBZNNMKLZIE3Z6QBYHTVZ57NBANCNFSM53EAYS2A . You are receiving this because you were mentioned.Message ID: @.***>

athomas avatar Aug 19 '22 13:08 athomas

Awesome, thanks @athomas!

@a-siva so the course of action is to cherry pick https://github.com/dart-lang/sdk/commit/6970e0907bf2cabe0d3e5da0846616d3ce972471 to the stable branch for a stable hotfix. Is this the desired outcome?

itsjustkevin avatar Aug 19 '22 14:08 itsjustkevin

Discussed offline with @mraleph and @mkustermann: hotfix approved for 2.17 based on low risk and user impact.

athomas avatar Aug 22 '22 07:08 athomas

This has been cherry-picked to the 2.17.7 stable patch release.

whesse avatar Aug 22 '22 14:08 whesse

This has been cherry-picked to the 2.17.7 stable patch release.

How can I manually upgrade the dart SDK in the flutter SDK?

Aaron009 avatar Aug 25 '22 01:08 Aaron009

How can I manually upgrade the dart SDK in the flutter SDK?

I some situations you could theoretically do that, but this fix requires rebuilding Flutter Engine binaries. Unless you are familiar with the process, I'd recommend waiting for this fix to be released as part of the normal Flutter release process (or upgrade to the Flutter channel which contains the fix).

mraleph avatar Aug 25 '22 10:08 mraleph

@itsjustkevin https://github.com/dart-lang/sdk/issues/49430#issuecomment-1226663642

athomas avatar Aug 26 '22 06:08 athomas