cunarist / rinf

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

Android App freeze on the splash screen #392

Closed H2Sxxa closed 1 month ago

H2Sxxa commented 1 month ago

Report

After upgrading rinf to 6.14.0.(from 6.6.1).The app will freeze in splash screen after using the virtual button to return to the desktop and open the app again.

Test with the example_app, I use the github action to build it and you can get it here.

https://github.com/H2Sxxa/rinf/actions/runs/9820065280

Here's a demo video.

https://github.com/cunarist/rinf/assets/88923783/391bdf7f-c615-4804-b843-41336fae7682

Steps to Reproduce

  1. Open the app and use the virtual button to return to the desktop.
  2. Open the app again.

System Information

Android 13
rustc --version
flutter doctor
temeddix commented 1 month ago

Hi @H2Sxxa , thank you for leaving the report :)

Right now it's unclear which change is causing the app to be stuck on the splash screen on app switch. Could you try removing this part of the code and share with us if the problem still remains?

// lib/main.dart
  late final AppLifecycleListener _listener;

  @override
  void initState() {
    super.initState();
    _listener = AppLifecycleListener(
      onExitRequested: () async {
        finalizeRust(); // Shut down the `tokio` Rust runtime.
        return AppExitResponse.exit;
      },
    );
  }

  @override
  void dispose() {
    _listener.dispose();
    super.dispose();
  }
H2Sxxa commented 1 month ago

Hi @H2Sxxa , thank you for leaving the report :)

Right now it's unclear which change is causing the app to be stuck on the splash screen on app switch. Could you try removing this part of the code and share with us if the problem still remains?

// lib/main.dart
  late final AppLifecycleListener _listener;

  @override
  void initState() {
    super.initState();
    _listener = AppLifecycleListener(
      onExitRequested: () async {
        finalizeRust(); // Shut down the `tokio` Rust runtime.
        return AppExitResponse.exit;
      },
    );
  }

  @override
  void dispose() {
    _listener.dispose();
    super.dispose();
  }

Thanks for reply, I just tested it and the problem still remains.

temeddix commented 1 month ago

I was able to reproduce the problem. I'll try to publish a new version with a fix soon.

H2Sxxa commented 1 month ago

Hi, @temeddix, thanks for your works on this project.

This issue doesn't seem to be completely resolved. After updating rinf to 6.14.1, when I tried to reproduce this problem, the app seems to work well ,but the signals from dart are blocked.

Here is a build, I have synced the branch.

https://github.com/H2Sxxa/rinf/actions/runs/9831225123/job/27138307739

The demo video, you can reproduce it via the FAB.

https://github.com/cunarist/rinf/assets/88923783/84be0797-bd2b-4fb5-9846-b43be313fed3

temeddix commented 1 month ago

I'll take a deeper look soon enough, thank you for sharing :)

temeddix commented 1 month ago

Do you mind sharing with us if the problem happens only in debug mode, or also in release mode?

H2Sxxa commented 1 month ago

Do you mind sharing with us if the problem happens only in debug mode, or also in release mode?

I tested from a release build, the problem should also in debug mode.

temeddix commented 1 month ago

Unfortunately, I couldn't reproduce the problem this time. DartSignals are working well after reopening.

https://github.com/cunarist/rinf/assets/66480156/5a300b4e-595b-47b0-8f43-d8288ffa0557

Could you try running rinf message again and check if the problem persists? Also, could you check that rinfpackage specified in both pubspec.yaml and Cargo.toml has version 6.14.1?

H2Sxxa commented 1 month ago

Unfortunately, I couldn't reproduce the problem this time. DartSignals are working well after reopening.

Screen.Recording.2024-07-08.at.10.30.40.PM.1.mp4 Could you try running rinf message again and check if the problem persists? Also, could you check that rinfpackage specified in both pubspec.yaml and Cargo.toml has version 6.14.1?

Yes, I checked them before building, I think there's no problem.

I clone rinf to local, run example with debug mode and release mode.

When I use debug mode, it seems all work well. (flutter run --debug)

https://github.com/cunarist/rinf/assets/88923783/642e650f-7d1d-4bfe-8fb5-b50d3fe3766d

But when I run in release mode, the problem appears again. (flutter run --release)

If you have time, could you try run in release mode and reproduce it again? Thanks.

temeddix commented 1 month ago

I think the problem can be fixed quite easily, I'll publish 6.14.2 soon.