Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart2js: "Maximum call stack size exceeded" when getter & setter for private fields in mixins #44636

Closed
noliran opened this issue Jan 10, 2021 · 4 comments
Assignees
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler

Comments

@noliran
Copy link

noliran commented Jan 10, 2021

Hi folks,

Background:
Working on getting an iOS and Android Flutter project that uses MobX to work with Flutter Web.

When I building the project with flutter build web and serving it, everything's fine.
However, when I try to run it with flutter run -d chrome I get a "Maximum call stack size exceeded" error:

The following JSRangeError was thrown building MyApp(dirty):
Invalid argument: Maximum call stack size exceeded

The relevant error-causing widget was: 
  MyApp file:///Users/_/git/js_bug_repro/lib/main.dart:34:10
When the exception was thrown, this was the stack: 
packages/js_bug_repro/main.dart 14:5                                     get [_test]
packages/js_bug_repro/main.dart 14:18                                    get [_test]
packages/js_bug_repro/main.dart 14:18                                    get [_test]
packages/js_bug_repro/main.dart 14:18                                    get [_test]
packages/js_bug_repro/main.dart 14:18                                    get [_test]
...
====================================================================================================

Steps to reproduce:
I've been able to peel away all the wizardry around MobX and reproduce the bug consistently in this gist: https://gist.github.com/noliran/27d10d009f847f55c232df0bc8353763

  • flutter run -d chrome

Potential workarounds:
--> Making the field public (_test -> test) solves the problem
--> Removing the Store mixin solves the problem
--> Running the output of flutter build web directly

Notes:

Environment:

  • Dart SDK version: 2.12.0-141.0.dev (dev) (Thu Dec 10 06:04:48 2020 -0800) on "macos_x64"
  • Flutter (Channel dev, 1.26.0-1.0.pre, on Mac OS X 10.15.6 19G2021 darwin-x64, locale en)
  • Mac OS X, Chrome
@vsmenon vsmenon added area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler labels Jan 10, 2021
@sigmundch
Copy link
Member

Thanks for the bug report, and thank you so much for the small reproduction case. That was really helpful!

Good news is that this was fixed very recently and you'll find the fix in an upcoming dev release! The fix landed in 52db62d, which will be part of any future Dart release higher than 2.12.0-180.0.dev.

We will add a regression test just in case, since I don't see this covered by the existing unit tests.

@sigmundch sigmundch self-assigned this Jan 12, 2021
@sigmundch
Copy link
Member

CL to add the regression test in https://dart-review.googlesource.com/c/sdk/+/178900

@noliran
Copy link
Author

noliran commented Jan 12, 2021

Thanks @sigmundch! great to hear. Let me know if I should close this issue then :)

dart-bot pushed a commit that referenced this issue Jan 12, 2021
This change adds a test to ensure we properly handle super calls in mixin that
override initializers.

This is a regression test for #44636,
which happened to trigger a stack-overflow in ddc.  The issue existed for a long
time, but was fixed in a recent CFE change
52db62d

Change-Id: I7d4aceb8e313f0000e32d9550f301792a9ab84cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178900
Reviewed-by: Nicholas Shahan <[email protected]>
Commit-Queue: Sigmund Cherem <[email protected]>
@noliran
Copy link
Author

noliran commented Mar 15, 2021

closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler
Projects
None yet
Development

No branches or pull requests

3 participants