cunarist / rinf

Rust for native business logic, Flutter for flexible and beautiful GUI
MIT License
1.96k stars 69 forks source link

example close in macos occurs error #178

Closed getong closed 1 year ago

getong commented 1 year ago

I run the example in macos, it run well, but after closing it, the error occurs:

../../third_party/dart/runtime/vm/virtual_memory_posix.cc: 70: error: mmap failed: 22 (Invalid argument)

macos 14.0

temeddix commented 1 year ago

I've experienced this issue myself too. I will inspect this when I get free again, thanks for the report :)

temeddix commented 1 year ago

Hello, I wanted to share my current progress.

That error message is nothing critical, it's just a mismatch of Dart-Rust closing time. This message appears because the Rust side(tokio runtime) is trying to send RustSignals right after Dart VM shutdown, within only tens of milliseconds. The example app is sending mandelbrot image every 20ms, and it attempted to do that right after Flutter app is closed, while the Rust logic(tokio runtime) remained alive.

It would be great to provide a mechanism to shutdown Rust side before Dart though, so I'll search for ways to implement this behavior. Thank you for your patience :)