Closed stuartmorgan closed 5 years ago
Note that (2) could be very useful, and doesn't require much set-up, just patience to try re-testing with a bunch of versions of the Flutter tree.
For anyone trying, even if you don't isolate it as far as possible, if you find any flutter hash that works for you, please post that hash and a hash that fails for you, so that narrowing the range can potentially be done collaboratively.
I successfully built flutter-desktop-embedding and the linux example, is my machine information relevant? If so you need the output from which commands?
P.S: I don't know if is relevant for this issue, but the example ran with 100% of one of my cores.
is my machine information relevant?
Currently we need debugging/information from people who have the crash, which it doesn't sound like is the case for you.
the example ran with 100% of one of my cores.
That's issue #58.
I've just finished testing each release of flutter until I found one that worked. It would seem something in v0.9.6 of flutter is the culprit (at least for me) as v0.9.5 and the handful of releases I tested before that all work fine. https://github.com/flutter/flutter/compare/v0.9.5...v0.9.6
A few notes:
cd ~/External/flutter
git checkout "$release"
cd ~/External/flutter-desktop-embedding/library/linux/
make
cd ~/External/flutter-desktop-embedding/example/linux
make
./out/flutter_embedder_example
Let me know if there's any other info I can provide. If I have some time, I'll try digging deeper into the the changes between these two versions, but hopefully this is a good starting point for someone else to investigate the issue.
Thanks for the investigation! That range includes https://github.com/flutter/engine/pull/6353, so that's the point where you'd hit #135. Have you tried bdc3dda5f298f50b432faaffe71730c4fe26afda (or anything shortly after that point), when the fix for #135 went in? While an obvious possible explanation is that that something about that didn't work for some graphics configuration, it's also possible that the fix did work, but then there was a later regression.
For more info, here's the stack trace using a locally built engine. I'm still tracking it down but hopefully this might be useful for other folks to find the culprit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe8d30700 (LWP 71051)]
[New Thread 0x7fffe3fff700 (LWP 71052)]
[New Thread 0x7fffe14f2700 (LWP 71053)]
[New Thread 0x7fffe0cf1700 (LWP 71054)]
[New Thread 0x7fffd3fff700 (LWP 71055)]
[New Thread 0x7fffe0418700 (LWP 71056)]
[New Thread 0x7fffd35ff700 (LWP 71057)]
[New Thread 0x7fffd2d3f700 (LWP 71058)]
[New Thread 0x7fffd2c3e700 (LWP 71059)]
[New Thread 0x7fffd297f700 (LWP 71060)]
flutter: Observatory listening on http://127.0.0.1:46099/
../../third_party/skia/src/gpu/gl/GrGLInterface.cpp:582 GrGLInterface::validate() failed.
[ERROR:flutter/shell/gpu/gpu_surface_gl.cc(85)] Failed to setup Skia Gr context.
Thread 5 "io.flutter.gpu" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe0cf1700 (LWP 71054)]
sk_sp<GrCaps const>::operator-> (this=0x10) at ../../third_party/skia/include/core/SkRefCnt.h:288
288 T* operator->() const { return fPtr; }
(gdb) bt
#0 0x00007ffff670c52c in sk_sp<GrCaps const>::operator->() const (this=0x10)
at ../../third_party/skia/include/core/SkRefCnt.h:288
#1 0x00007ffff6705bed in GrContext::maxSurfaceSampleCountForColorType(SkColorType) const
(this=0x0, colorType=kRGBA_8888_SkColorType) at ../../third_party/skia/src/gpu/GrContext.cpp:363
#2 0x00007ffff6fd923b in GrContext::colorTypeSupportedAsSurface(SkColorType) const
(this=0x0, colorType=kRGBA_8888_SkColorType) at ../../third_party/skia/include/gpu/GrContext.h:229
#3 0x00007ffff6fd780e in shell::FirstSupportedColorType(GrContext*, unsigned int*)
(context=0x0, format=0x7fffe0cef9dc) at ../../flutter/shell/gpu/gpu_surface_gl.cc:162
#4 0x00007ffff6fd6b94 in shell::WrapOnscreenSurface(GrContext*, SkISize const&, long)
(context=0x0, size=..., fbo=0) at ../../flutter/shell/gpu/gpu_surface_gl.cc:172
#5 0x00007ffff6fd680e in shell::GPUSurfaceGL::CreateOrUpdateSurfaces(SkISize const&) (this=
0x55555597cf00, size=...) at ../../flutter/shell/gpu/gpu_surface_gl.cc:236
#6 0x00007ffff6fd7131 in shell::GPUSurfaceGL::AcquireRenderSurface(SkISize const&, SkMatrix const&)
(this=0x55555597cf00, untransformed_size=..., root_surface_transformation=...)
at ../../flutter/shell/gpu/gpu_surface_gl.cc:353
#7 0x00007ffff6fd6f7c in shell::GPUSurfaceGL::AcquireFrame(SkISize const&)
(this=0x55555597cf00, size=...) at ../../flutter/shell/gpu/gpu_surface_gl.cc:282
#8 0x00007ffff6ccecc4 in shell::Rasterizer::DrawToSurface(flow::LayerTree&)
(this=0x7fffd8000af0, layer_tree=...) at ../../flutter/shell/common/rasterizer.cc:160
#9 0x00007ffff6ccf34f in shell::Rasterizer::DoDraw(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >) (this=0x7fffd8000af0, layer_tree=...)
at ../../flutter/shell/common/rasterizer.cc:152
#10 0x00007ffff6cd41e6 in _ZNSt3__28__invokeIRMN5shell10RasterizerEFvNS_10unique_ptrIN4flow9LayerTreeENS_14default_deleteIS5_EEEEERPS2_JS8_EvEEDTcldsdeclsr3std3__2E7forwardIT0_Efp0_Efp_spclsr3std3__2E7forwardIT1_Efp1_EEEOT_OSE_DpOSF_ (__f=
@0x7fffe0cf07c8: (void (shell::Rasterizer::*)(shell::Rasterizer * const, std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >)) 0x7ffff6ccf2f0 <shell::Rasterizer::DoDraw(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >)>, __a0=@0x7fffe0cf07d8: 0x7fffd8000af0, __args=...)
at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/type_traits:4291
#11 0x00007ffff6cd40fd in _ZNSt3__215__apply_functorIMN5shell10RasterizerEFvNS_10unique_ptrIN4flow9LayerTreeENS_14default_deleteIS5_EEEEENS_5tupleIJPS2_NS_12placeholders4__phILi1EEEEEEJLm0ELm1EENSB_IJOS8_EEEEENS_13__bind_returnIT_T0_T2_Xsr22__is_valid_bind_returnISK_SL_SM_EE5valueEE4typeERSK_RSL_NS_15__tuple_indicesIJXspT1_EEEEOSM_ (__f=
@0x7fffe0cf07c8: (void (shell::Rasterizer::*)(shell::Rasterizer * const, std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >)) 0x7ffff6ccf2f0 <shell::Rasterizer::DoDraw(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >)>, __bound_args=..., __args=...)
at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/functional:2226
#12 0x00007ffff6cd408c in _ZNSt3__26__bindIMN5shell10RasterizerEFvNS_10unique_ptrIN4flow9LayerTreeENS_14default_deleteIS5_EEEEEJPS2_RKNS_12placeholders4__phILi1EEEEEclIJS8_EEENS_13__bind_returnISA_NS_5tupleIJSB_SE_EEENSK_IJDpOT_EEEXsr22__is_valid_bind_returnISA_SL_SP_EE5valueEE4typeESO_
(this=0x7fffe0cf07c8, __args=...)
at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/functional:2259
#13 0x00007ffff6cd4022 in _ZNSt3__28__invokeIRNS_6__bindIMN5shell10RasterizerEFvNS_10unique_ptrIN4flow9LayerTreeENS_14default_deleteIS6_EEEEEJPS3_RKNS_12placeholders4__phILi1EEEEEEJS9_EEEDTclclsr3std3__2E7forwardIT_Efp_Espclsr3std3__2E7forwardIT0_Efp0_EEEOSK_DpOSL_ (__f=..., __args=...)
at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/type_traits:4350
#14 0x00007ffff6cd3fc2 in std::__2::__invoke_void_return_wrapper<void>::__call<std::__2::__bind<void (shell::Rasterizer::*)(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >), shell::Rasterizer*, std::__2::placeholders::__ph<1> const&>&, std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> > >(std::__2::__bind<void (shell::Rasterizer::*)(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >), shell::Rasterizer*, std::__2::placeholders::__ph<1> const&>&, std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >&&)
(__args=..., __args=...) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/__functional_base:349
#15 0x00007ffff6cd3289 in std::__2::__function::__func<std::__2::__bind<void (shell::Rasterizer::*)(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >), shell::Rasterizer*, std::__2::placeholders::__ph<1> const&>, std::__2::allocator<std::__2::__bind<void (shell::Rasterizer::*)(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >), shell::Rasterizer*, std::__2::placeholders::__ph<1> const&> >, void (std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >)>::operator()(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >&&) (this=0x7fffe0cf07c0, __arg=...) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/functional:1572
#16 0x00007ffff6cd4475 in std::__2::function<void (std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >)>::operator()(std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >) const (this=0x7fffe0cf07c0, __arg=...) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/functional:1923
#17 0x00007ffff6cd256b in flutter::Pipeline<flow::LayerTree>::Consume(std::__2::function<void (std::__2::unique_ptr<flow::LayerTree, std::__2::default_delete<flow::LayerTree> >)>) (this=0x7fffd4000bd0, consumer=...) at ../../flutter/synchronization/pipeline.h:130
#18 0x00007ffff6ccf1c0 in shell::Rasterizer::Draw(fml::RefPtr<flutter::Pipeline<flow::LayerTree> >) (this=0x7fffd8000af0, pipeline=...) at ../../flutter/shell/common/rasterizer.cc:81
#19 0x00007ffff6d01fcc in shell::Shell::OnAnimatorDraw(fml::RefPtr<flutter::Pipeline<flow::LayerTree> >)::$_23::operator()() const (this=0x7fffd80014c8) at ../../flutter/shell/common/shell.cc:691
#20 0x00007ffff6d01f4d in _ZNSt3__28__invokeIRZN5shell5Shell14OnAnimatorDrawEN3fml6RefPtrIN7flutter8PipelineIN4flow9LayerTreeEEEEEE4$_23JEEEDTclclsr3std3__2E7forwardIT_Efp_Espclsr3std3__2E7forwardIT0_Efp0_EEEOSD_DpOSE_ (__f=...) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/type_traits:4350
#21 0x00007ffff6d01efd in std::__2::__invoke_void_return_wrapper<void>::__call<shell::Shell::OnAnimatorDraw(fml::RefPtr<flutter::Pipeline<flow::LayerTree> >)::$_23&>(shell::Shell::OnAnimatorDraw(fml::RefPtr<flutter::Pipeline<flow::LayerTree> >)::$_23&) (__args=...) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/__functional_base:349
#22 0x00007ffff6d013b1 in std::__2::__function::__func<shell::Shell::OnAnimatorDraw(fml::RefPtr<flutter::Pipeline<flow::LayerTree> >)::$_23, std::__2::allocator<shell::Shell::OnAnimatorDraw(fml::RefPtr<flutter::Pipeline<flow::LayerTree> >)::$_23>, void ()>::operator()() (this=0x7fffd80014c0) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/functional:1572
#23 0x00007ffff6002fa5 in std::__2::function<void ()>::operator()() const (this=0x7fffd8000a40) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/functional:1923
#24 0x00007ffff6002163 in fml::MessageLoopImpl::RunExpiredTasks() (this=0x7fffd80008e0) at ../../flutter/fml/message_loop_impl.cc:141
#25 0x00007ffff6001f25 in fml::MessageLoopImpl::RunExpiredTasksNow() (this=0x7fffd80008e0) at ../../flutter/fml/message_loop_impl.cc:52
#26 0x00007ffff6012735 in fml::MessageLoopLinux::OnEventFired() (this=0x7fffd80008e0) at ../../flutter/fml/platform/linux/message_loop_linux.cc:86
#27 0x00007ffff60126d7 in fml::MessageLoopLinux::Run() (this=0x7fffd80008e0) at ../../flutter/fml/platform/linux/message_loop_linux.cc:69
#28 0x00007ffff60025cf in fml::MessageLoopImpl::DoRun() (this=0x7fffd80008e0) at ../../flutter/fml/message_loop_impl.cc:77
#29 0x00007ffff600000d in fml::MessageLoop::Run() (this=0x7fffd80008c0) at ../../flutter/fml/message_loop.cc:51
#30 0x00007ffff600f541 in fml::Thread::Thread(std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> > const&)::$_0::operator()() const (this=0x5555558c1a48) at ../../flutter/fml/thread.cc:34
#31 0x00007ffff600f48d in _ZNSt3__28__invokeIZN3fml6ThreadC1ERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEE3$_0JEEEDTclclsr3std3__2E7forwardIT_Efp_Espclsr3std3__2E7forwardIT0_Efp0_EEEOSC_DpOSD_ (__f=...) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/type_traits:4350
#32 0x00007ffff600f435 in std::__2::__thread_execute<std::__2::unique_ptr<std::__2::__thread_struct, std::__2::default_delete<std::__2::__thread_struct> >, fml::Thread::Thread(std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> > const&)::$_0>(std::__2::tuple<std::__2::unique_ptr<std::__2::__thread_struct, std::__2::default_delete<std::__2::__thread_struct> >, fml::Thread::Thread(std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> > const&)::$_0>&, std::__2::__tuple_indices<>) (__t=...) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/thread:342
#33 0x00007ffff600f1b3 in std::__2::__thread_proxy<std::__2::tuple<std::__2::unique_ptr<std::__2::__thread_struct, std::__2::default_delete<std::__2::__thread_struct> >, fml::Thread::Thread(std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> > const&)::$_0> >(void*) (__vp=0x5555558c1a40) at /usr/local/google/home/franciscojma/Developer/engine/src/buildtools/linux-x64/clang/lib/clang/8.0.0/include/c++/v1/thread:352
#34 0x00007ffff30df494 in start_thread (arg=0x7fffe0cf1700) at pthread_create.c:333
#35 0x00007ffff3b27a8f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
The crash is almost certainly a symptom of the context being null; the critical question is what happened to cause
[ERROR:flutter/shell/gpu/gpu_surface_gl.cc(85)] Failed to setup Skia Gr context.
rather than the crash itself.
I can confirm the finding by @ciiqr. v0.9.5
works fine, crash starts at v0.9.6
.
I'm running Ubuntu 18.04 minimal installation. I have manually installed X11, lightdm and am using xmonad as window manager. xmonad is a tiling window manager, which is something that 'awesome wm' used by @ciiqr may do as well. I have seen some applications break when they can't resize themselves or when a tiling window manager resizes them to fit their appointed tile. However, I configured my xmonad to let the application float, which should allow it to resize itself to any size it wants. The application still breaks (after shortly popping on screen). So it doesn't seem to be related to non-floating, but may still be related to the non-standard window managers doing something that others don't.
I used this config in the xmonad manage hook to float the window: <+> (className =? "Flutter_embedder__example" --> doFloat)
.
I saw in the mentioned commits that the changes were mostly about OpenGL vs OpenGL ES? I'm not a native C++ speaker so I don't think I'll be able to properly debug this. But perhaps this information is interesting:
$ glxinfo -v | grep "OpenGL"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 1070/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 396.54
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 396.54
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 396.54
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
Another thing: I'm running a 4K display. This may seem a bit far-fetched, but there are still quite a few applications on linux that have trouble on HiDPI displays. The display is rendered natively at 3840x2160
(no upscaling).
I can confirm the finding by @ciiqr. v0.9.5 works fine, crash starts at v0.9.6.
As I responed above, a crash in 0.9.6 is #135, which affected everyone on Linux. The question now is whether any version with the fix for that bug (see my comment for the first hash to test) worked.
@stuartmorgan Sorry I forgot to mention this. I tried bdc3dda5f298f50b432faaffe71730c4fe26afda
and it didn't work.
I have now setup local engine development (after hacking my way through install scripts, because ubuntu 18.04 isn't supported) and am trying to see what values I get for that OpenGL ES detection. I'm thinking it may have to do with nvidia driver? Is there anything you'd recommend to try? @stuartmorgan
~Actually, without changing anything, I already get more info when using the latest engine. Not sure if this is a different or related/causing problem though. Existing issue for this error message; flutter/flutter#21810 (Already cleared cache, as advised in that issue)~
[ERROR:flutter/shell/gpu/gpu_surface_gl.cc(85)] Failed to setup Skia Gr context.
[ERROR:flutter/shell/common/shell.cc(186)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
[ERROR:flutter/shell/common/engine.cc(176)] Could not prepare to run the isolate.
[ERROR:flutter/shell/common/engine.cc(123)] Engine not prepare and launch isolate.
[ERROR:flutter/shell/platform/embedder/embedder_engine.cc(61)] Could not launch the engine with configuration.
~The application doesn't crash this time, just one empty window (not the Flutter_embedder_example
application itself, but that other window).~
edit: The error above (in strikethrough) seems to be unrelated to the Skia context stuff. I updated tools/build_flutter_assets
to use the local engine. But the example/linux/Makefile
still uses the libflutter_engine.so
from library/linux
. That file seems to be placed there by tools/update_flutter_engine
. Support for a local engine seems to be lacking there? I bypassed the whole thing by modifying example/linux/Makefile
line 28, setting FLUTTER_ENGINE_LIB
to point directly to the libflutter_engine.so of my local engine build. That works, and I can no actually try some engine modifications with the example app. Should support for engine switching in tools/update_flutter_engine
be a new issue, or am I missing something?
flutter: Observatory listening on http://127.0.0.1:42409/
../../third_party/skia/src/gpu/gl/GrGLInterface.cpp:582 GrGLInterface::validate() failed.
[ERROR:flutter/shell/gpu/gpu_surface_gl.cc(90)] Failed to setup Skia Gr context.
In GrGLInterface.cpp:
if (fExtensions.has("GL_EXT_window_rectangles")) {
if (!fFunctions.fWindowRectangles) {
RETURN_FALSE_INTERFACE;
}
}
In my case, the interface being validated was created by skia's GrGLMakeAssembledGLInterface
which does support the extension. So I have no idea why the check fails.
I'm going to stop trying to figure this out further as we seem to be heading into the realm of Skia. The complex C++ there is way above my head as I never work with C++, and have almost no experience with GL either. But I hope this information helps whomever may continue this .
Should support for engine switching in tools/update_flutter_engine be a new issue, or am I missing something?
That's already #160
Thanks for the added details; I'll take a look at that Skia code when I get a chance and see where the function that is missing (if that's the line that returned failure) would be populated
@stuartmorgan, I think I have the same issue and switching from my nvidia card to the integrated card made it not crash
I couldn't let it go and got a small bit further. Found that indeed the symbol could not be resolved to set fFunctions.fWindowrectangles
.
flutter/fml/platform/posix/native_library_posix.cc(63): Could not resolve symbol in library: glWindowRectanglesEXT
I have a fix locally. Working on a PR now.
I have the same error ("Failed to setup Skia Gr context") despite making sure I have all the dependencies. I have the latest beta engine version ("7375a0f414bde4bc941e623482221db2fc8c4ab5"). I am running KDE neon on my computer and can provide more information if needed.
Please file a new issue, since the specific cause that was being tracked here was fixed, so what you are seeing would be something different.
With recent builds, some people are seeing persistent "Failed to setup Skia Gr context" logging + crash on startup.
Unlike the previous instance (#135), this does not affect all Linux configurations, only some, which suggests this may be driver related, or capability-related. For instance, in at least one instance I'm aware of the crash happens when using a machine normally, but not when using Chrome Remote Desktop to access the same machine.
Things that could be useful from people experiencing this:
(3) would be the most useful, but is obviously the most involved. I believe @franciscojma86 will be trying this route.