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

Running macos example: EXC_BAD_ACCESS (code=1, address=0xc3) #33

Closed
pulyaevskiy opened this issue Mar 29, 2018 · 16 comments
Closed

Running macos example: EXC_BAD_ACCESS (code=1, address=0xc3) #33

pulyaevskiy opened this issue Mar 29, 2018 · 16 comments

Comments

@pulyaevskiy
Copy link

Steps to reproduce

  1. Open macos/example/Example Embedder.xcodeproj in Xcode
  2. Build and run

Expected result: the example app starts and runs

Actual result: Xcode stops execution on exception:

ui_thread (7): EXC_BAD_ACCESS (code=1, address=0xc3) 

I'm probably doing something wrong, but the docs are not super clear and I don't have a lot of experience with Xcode.

Flutter Doctor

flutter doctor -v
[✓] Flutter (Channel master, v0.2.5-pre.41, on Mac OS X 10.13.3 17D102, locale en-BY)
    • Flutter version 0.2.5-pre.41 at /Users/anatoly/flutter
    • Framework revision 2171fcb882 (4 days ago), 2018-03-25 00:04:24 -0700
    • Engine revision 6280adbfb1
    • Dart version 2.0.0-dev.39.0.flutter-06949dc985

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.3)
    • Android SDK at /Users/anatoly/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-26, build-tools 26.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.2, Build version 9C40b
    • ios-deploy 1.9.2
    • CocoaPods version 1.3.1

[✓] Android Studio (version 3.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)

[✓] IntelliJ IDEA Community Edition (version 2017.3.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 22.2.2
    • Dart plugin version 173.4548.30

[✓] VS Code (version 1.21.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Dart Code extension version 2.11.1

[!] Connected devices
    ! No devices available
@awdavies
Copy link
Contributor

I ran through the same steps and got the same thing! Woo! I'll get back once I've done some more debugging.

@awdavies
Copy link
Contributor

Backtrace for context:

* thread #8, name = 'ui_thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xc3)
  * frame #0: 0x0000000101792a83 FlutterEmbedder`dart::Class::NumTypeArguments() const + 35
    frame #1: 0x0000000101b4d42c FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::EvaluateConstructorInvocationInternal() + 812
    frame #2: 0x0000000101b491b3 FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::EvaluateExpression(long, bool) + 1235
    frame #3: 0x0000000101b4dfeb FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::EvaluateMapLiteralInternal() + 699
    frame #4: 0x0000000101b4971f FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::EvaluateExpression(long, bool) + 2623
    frame #5: 0x0000000101b50c4e FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::RunFunction(dart::Function const&, long, dart::Instance const*, dart::TypeArguments const*) + 910
    frame #6: 0x0000000101b4d81f FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::EvaluateConstructorInvocationInternal() + 1823
    frame #7: 0x0000000101b491b3 FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::EvaluateExpression(long, bool) + 1235
    frame #8: 0x0000000101b7ba48 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildGraph(long) + 6824
    frame #9: 0x0000000101b8fe1e FlutterEmbedder`dart::kernel::FlowGraphBuilder::BuildGraph() + 1150
    frame #10: 0x0000000101bd9366 FlutterEmbedder`dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*> const&, long, bool) + 118
    frame #11: 0x0000000101bdd24e FlutterEmbedder`dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*) + 3166
    frame #12: 0x0000000101be4a95 FlutterEmbedder`dart::Compiler::EvaluateStaticInitializer(dart::Field const&) + 1093
    frame #13: 0x0000000101b4b9c8 FlutterEmbedder`dart::kernel::StreamingConstantEvaluator::EvaluateExpression(long, bool) + 11496
    frame #14: 0x0000000101b59136 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildExpression(dart::TokenPosition*) + 30166
    frame #15: 0x0000000101b65e00 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildArgumentsFromActualArguments(dart::Array*, bool, bool) + 1712
    frame #16: 0x0000000101b66471 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildArguments(dart::Array*, long*, long*, bool, bool) + 529
    frame #17: 0x0000000101b6033a FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildStaticInvocation(bool, dart::TokenPosition*) + 1850
    frame #18: 0x0000000101b51c1d FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildExpression(dart::TokenPosition*) + 189
    frame #19: 0x0000000101b65e00 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildArgumentsFromActualArguments(dart::Array*, bool, bool) + 1712
    frame #20: 0x0000000101b66471 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildArguments(dart::Array*, long*, long*, bool, bool) + 529
    frame #21: 0x0000000101b61339 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildConstructorInvocation(bool, dart::TokenPosition*) + 3449
    frame #22: 0x0000000101b5256b FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildExpression(dart::TokenPosition*) + 2571
    frame #23: 0x0000000101b68e3f FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildStatement() + 1359
    frame #24: 0x0000000101b6a9b8 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildStatement() + 8392
    frame #25: 0x0000000101b78613 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildGraphOfFunction(bool) + 11171
    frame #26: 0x0000000101b7a507 FlutterEmbedder`dart::kernel::StreamingFlowGraphBuilder::BuildGraph(long) + 1383
    frame #27: 0x0000000101b8fe1e FlutterEmbedder`dart::kernel::FlowGraphBuilder::BuildGraph() + 1150
    frame #28: 0x0000000101bd9366 FlutterEmbedder`dart::DartCompilationPipeline::BuildFlowGraph(dart::Zone*, dart::ParsedFunction*, dart::ZoneGrowableArray<dart::ICData const*> const&, long, bool) + 118
    frame #29: 0x0000000101bdd24e FlutterEmbedder`dart::CompileParsedFunctionHelper::Compile(dart::CompilationPipeline*) + 3166
    frame #30: 0x0000000101bda96c FlutterEmbedder`dart::CompileFunctionHelper(dart::CompilationPipeline*, dart::Function const&, bool, long) + 2220
    frame #31: 0x0000000101bda062 FlutterEmbedder`dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&) + 914
    frame #32: 0x0000000101bd97ee FlutterEmbedder`dart::DRT_CompileFunction(dart::NativeArguments) + 654
    frame #33: 0x000000010af8063b
    frame #34: 0x000000010af806af
    frame #35: 0x000000010fb02bf4
    frame #36: 0x000000010fb026d5
    frame #37: 0x000000010fb02453
    frame #38: 0x000000010fb02279
    frame #39: 0x000000010fb01c5b
    frame #40: 0x000000010fb017d7
    frame #41: 0x000000010fb0155d
    frame #42: 0x000000010fb00e47
    frame #43: 0x000000010e77c99b
    frame #44: 0x000000010e77c853
    frame #45: 0x000000010e74a4b2
    frame #46: 0x000000010e77b886
    frame #47: 0x000000010e778f18
    frame #48: 0x000000010e777b21
    frame #49: 0x000000010e74b1a4
    frame #50: 0x000000010e74a7e0
    frame #51: 0x000000010e74a5f3
    frame #52: 0x000000010e74a4b2
    frame #53: 0x000000010e7499b5
    frame #54: 0x000000010e7496d5
    frame #55: 0x000000010e7495e0
    frame #56: 0x000000010af80a83
    frame #57: 0x00000001016f808d FlutterEmbedder`dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long) + 973
    frame #58: 0x00000001017347a8 FlutterEmbedder`dart::IsolateMessageHandler::HandleMessage(dart::Message*) + 4600
    frame #59: 0x00000001017841da FlutterEmbedder`dart::MessageHandler::HandleMessages(dart::MonitorLocker*, bool, bool) + 666
    frame #60: 0x0000000101cfea82 FlutterEmbedder`Dart_HandleMessage + 754
    frame #61: 0x0000000100f40239 FlutterEmbedder`std::__1::__function::__func<tonic::DartMessageHandler::OnMessage(tonic::DartState*)::$_0, std::__1::allocator<tonic::DartMessageHandler::OnMessage(tonic::DartState*)::$_0>, void ()>::operator()() + 553
    frame #62: 0x0000000100e9d443 FlutterEmbedder`fml::MessageLoopImpl::RunExpiredTasks() + 3699
    frame #63: 0x0000000100e9f31c FlutterEmbedder`fml::MessageLoopDarwin::OnTimerFire(__CFRunLoopTimer*, fml::MessageLoopDarwin*) + 44
    frame #64: 0x00007fff35df1dd4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
    frame #65: 0x00007fff35df1a47 CoreFoundation`__CFRunLoopDoTimer + 1095
    frame #66: 0x00007fff35df154a CoreFoundation`__CFRunLoopDoTimers + 346
    frame #67: 0x00007fff35de8b4b CoreFoundation`__CFRunLoopRun + 2427
    frame #68: 0x00007fff35de7f43 CoreFoundation`CFRunLoopRunSpecific + 483
    frame #69: 0x0000000100e9f06d FlutterEmbedder`fml::MessageLoopDarwin::Run() + 93
    frame #70: 0x0000000100e9e207 FlutterEmbedder`std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0> >(void*, void*) + 375
    frame #71: 0x00000001029216b9 libsystem_pthread.dylib`_pthread_body + 340
    frame #72: 0x0000000102921565 libsystem_pthread.dylib`_pthread_start + 377
    frame #73: 0x0000000102920c55 libsystem_pthread.dylib`thread_start + 13

@awdavies
Copy link
Contributor

Well, I'm a bit stumped... my guess is that this has something to do with the bundled flutter_assets but I'm not entirely sure yet (Xcode/MacOS is not my strong suit).

@pulyaevskiy
Copy link
Author

Thanks, good to know that it's not only me seeing this. I'll try to debug more when I have time.

Also, wondering if @chinmaygarde can give an advice here?

@chinmaygarde
Copy link
Member

cc @rmacnak-google. The VM and isolate launch seem to be successful so I don't think this is related to the switch to Dart 2 and Kernel files.

@awdavies: Can you list the files in the flutter_assets folder?

@chinmaygarde
Copy link
Member

Also, is there a reduced test case? On tip-of-tree, the desktop embedder I use seems to be fine.

@krisgiesing
Copy link
Contributor

That example app is pretty stripped down already. BTW, I wasn't able to reproduce this either. I wonder if it has something to do with undocumented requirements on directory structure or something.

@chinmaygarde
Copy link
Member

Can you clear the build directory and try again? Ryan is working on a document detailing the locations of the various assets. However, I don't think this issue is caused by that (since it would affect VM/Isolate launch).

@rmacnak-google
Copy link

My changes to assets only affect Fuchsia, not macOS.

Where can I add VM flags? How do I run this with an engine that hasn't been stripped?

@awdavies
Copy link
Contributor

@chinmaygarde That guess was pretty shot-in-the-dark, but here's the files:

screen shot 2018-03-30 at 3 33 54 pm

@stuartmorgan
Copy link
Collaborator

I can repro this with ToT Flutter.

Switching to source mode in the embedder works fine; given that and the timing it does seem like Dart 2/kernel mode is suspect here.

@stuartmorgan
Copy link
Collaborator

stuartmorgan commented Apr 2, 2018

Some answers/comments, as I'm catching up on this:

On tip-of-tree, the desktop embedder I use seems to be fine.

Does your embedder use source mode? If not, how are you building the assets directory?

Can you list the files in the flutter_assets folder?

Expanding on the list @awdavies provided, that directory is the result of running:
flutter build flx
since that's was the easiest way I was aware of that creates and bundles are the relevant pieces. Is that no longer valid in the post-Dart-2 world?

Where can I add VM flags?

You can pass arguments to the embedder by adding to the commandLineArguments array in ExampleWindow.swift. I'm not sure if the Flutter embedding API filters arguments internally before passing them down the stack though.

How do I run this with an engine that hasn't been stripped?

The easiest way at the moment on macOS (where it's set up to download a prebuilt engine) is to build once to get that engine, then replace it (flutter_engine_framework/FlutterEmbedder.framework relative to the parent directory where you checked out this repo) with an unstripped version that you've built.

@stuartmorgan
Copy link
Collaborator

Current status is that the engine CL referenced just above is expected to fix this (I haven't built yet to test), but Flutter hasn't rolled their engine version past that fix yet.

So on macOS you'll need to wait for Flutter to roll their engine version again. On Linux you'll need to update your engine to/past that fix and rebuild.

On either platform, you can work around this in the short term by using source mode instead of snapshot mode, but the examples aren't set up for source mode since it doesn't allow easy packaging.

@stuartmorgan
Copy link
Collaborator

I haven't built yet to test

I've now build the engine locally and verified that that fix resolves this on macOS. I'll leave this open until Flutter rolls the engine, at which point the example will work out of the box again.

@pulyaevskiy
Copy link
Author

pulyaevskiy commented Apr 4, 2018

Looks like Flutter roll happened in flutter/flutter#16232 . I just upgraded and it looks sooo much better now.

image

@stuartmorgan
Copy link
Collaborator

Closing based on the roll.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants