Closed nyanpasu64 closed 3 years ago
I haven't tested it with nVidia driver in a while. I reported similar issue that causes crash on linux when opening new window (that happened in nVidia driver) here: https://github.com/flutter/flutter/issues/82353 . But it has been fixed in the meanwhile.
Sadly the symbols are all gone in regular engine builds, and even with symbols the crash might have been caused by something seemingly unrelated that has happened before. Still, I'll try to reproduce this with nVidia driver over the weekend.
Sorry, my bad, the actual issue was this: https://github.com/flutter/engine/pull/26070
It causes a thread terminating when opening new window. But it also only happened with lldb attached. So it might not be related to your issue.
For me, the issue occurs in both cargo run
and with a debugger attached.
I also got a rendering issue (though I cannot reproduce it reliably):
Not sure if it's my terrible potato GPU, or Nvidia's drivers, that's causing the rendering errors.
That really looks like a skia/gpu issue. Really not sure what to do about that.
I seem to be able to reproduce the crash. Looks like a possible regression in Flutter engine. The artifacts might be related. I'll look into this.
Is there some sort of uninitialized memory being used, or a wild pointer write, in either Flutter or the nativeshell glue code (or perhaps the proprietary nvidia drivers, but I don't know)?
I've noticed that if I run valgrind target/release/nativeshell_examples
:
Sadly RUSTFLAGS=-Zsanitizer=address cargo +nightly run -Zbuild-std --target x86_64-unknown-linux-gnu
didn't help because the crash occurred in a libflutter_linux_gtk.so call stack. I did verify that Echo and Long Running Task didn't trip up asan or valgrind's memory error warnings.
Is it viable to build libflutter_linux_gtk.so from source?
It's a bit more convoluted. NativeShell creates windows that are initially hidden (and shown only after the content is ready). Unfortunately NVIDIA driver seems to have problem with this - creating GLX surface with hidden window sometimes corrupts parent OpenGL context (that causes those crashes and artifacts you're seeing). It happens regardless of GPU, it's definitely a driver thing. I'm currently testing a workaround for this.
I was able to reproduce this with mesa/gallium, which finally allowed me to debug the issue. Looks like this is a bug in Flutter.
Indeed. This is definitely bug in Flutter Rasterizer. When setting resource cache limits it deletes buffer from wrong context. I'll submit PR to fix this tomorrow.
The issue is tracked here: https://github.com/flutter/flutter/issues/84930
The issue seems to be resolved after I flutter upgrade
to https://github.com/flutter/engine/commit/1eb8a34a3975070c42bc69f3981348dfa4f50a2d.
What's the correct procedure to rebuild the necessary parts of nativeshell after upgrading Flutter? Is rm -rf target/{debug,release}/build/nativeshell*
and rm -rf target/{debug,release}/incremental/
sufficient? Will it delete more than necessary?
Normally to update depenencies you'd do
$ cargo update
$ dart pub upgrade
then touch any of the dart files in your project (i.e. lib/main.dart
) and cargo build
should do the right thing. However the corresponding dart and cargo packages have not been published yet. I'll do it in next few days.
I think you shoud also be able modify the cargo.toml and pubspec.yaml to specify git repository (+ the subpath in pubspec.yaml, cargo should find the appropriate subdirectory automatically according to the documentation).
What I normally do during development is that I have the nativeshell
repo checked out and use path
in both pubspec.yaml
and cargo.toml
to find the appropriate nativeshell packages.
I'm running this repo, latest main d385acefcc2405ddb863f79e3ccdb4479891008c, on Linux.
If I press the "Long Running Task" button one or more times, then either wait for it to finish or not, then "Open in New Window", the app will usually segfault instead of opening a window.
Stack trace is as follows (sadly it's a bit useless since libflutter_linux_gtk.so has no symbols):
I'm not sure if it's a NativeShell bug, example bug, Flutter bug, or Nvidia proprietary driver issue. (My GPU is awful, and the driver is awful too, but it's all I have to use. Adding/removing nvidia-drm.modeset=1 to the kernel command line didn't affect this bug.)
Flutter version:
Flutter 2.3.0-17.0.pre.386 • channel master • https://github.com/flutter/flutter.git Framework • revision c6cd8a60c3 (17 hours ago) • 2021-06-16 22:14:02 -0400 Engine • revision df3aa14215 Tools • Dart 2.14.0 (build 2.14.0-216.0.dev)
System info:
Operating System: Arch Linux KDE Plasma Version: 5.22.1 KDE Frameworks Version: 5.83.0 Qt Version: 5.15.2 Kernel Version: 5.12.10-zen1-1-zen (64-bit) Graphics Platform: X11 Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor Memory: 15.6 GiB of RAM Graphics Processor: NVIDIA GeForce GT 730/PCIe/SSE2