Skip to content

Conversation

@levkropp
Copy link
Contributor

resolves #4175

image

This pull request introduces changes to improve error handling and user experience when the FFI library fails to load. The updates include a new mechanism to detect FFI availability, enhancements to the DaemonUnavailable widget, and modifications to providers for better integration.

Error Handling for FFI Library:

  • src/client/gui/lib/ffi.dart: Introduced the FFILibrary class to encapsulate FFI library loading logic, handle errors gracefully, and provide utility methods (isFFIAvailable and ffiLoadError) for checking availability and accessing load errors.

User Interface Enhancements:

  • src/client/gui/lib/daemon_unavailable.dart: Updated the DaemonUnavailable widget to display a fatal error message and an "Exit Application" button when the FFI library fails to load. Added a conditional check for ffiAvailableProvider to differentiate between fatal errors and regular daemon unavailability. [1] [2]

Provider Updates:

  • src/client/gui/lib/providers.dart: Added a new provider, ffiAvailableProvider, to propagate the FFI availability status throughout the application. Updated grpcClientProvider and daemonAvailableProvider to incorporate FFI availability checks, ensuring dependent functionality behaves appropriately when the FFI library is unavailable. [1] [2]

* add error handling
* providerize FFI loading
* update providers to check FFI availability
@levkropp levkropp changed the title [ffi] Enhance FFI library loading [gui] Enhance FFI library loading Jun 23, 2025
@codecov
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.31%. Comparing base (47f57a0) to head (1352054).
⚠️ Report is 470 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4179   +/-   ##
=======================================
  Coverage   89.31%   89.31%           
=======================================
  Files         259      259           
  Lines       15684    15684           
=======================================
  Hits        14008    14008           
  Misses       1676     1676           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sharder996 sharder996 self-requested a review June 27, 2025 15:03
@levkropp levkropp marked this pull request as ready for review June 27, 2025 15:03
@sharder996 sharder996 requested a review from Sploder12 June 27, 2025 15:03
Copy link
Collaborator

@sharder996 sharder996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trusting you with the finer points of engineering Dart code, I'm wondering if it's possible to make the text selectable/copyable?


return IgnorePointer(
ignoring: available,
ignoring:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to no longer have available here?

@sharder996
Copy link
Collaborator

You can't make the text selectable? @levkropp

@levkropp
Copy link
Contributor Author

levkropp commented Jul 1, 2025

I added a button to copy the entire error to the clipboard. It seems more in line with how we do copying in multipass i.e with CopyableText (click to copy) and is faster for getting the error, but I have no strong feelings about it being just a SelectableText since this is a debug dialog.

@xmkg xmkg self-requested a review July 4, 2025 06:25
@xmkg
Copy link
Member

xmkg commented Jul 4, 2025

Tested in a local copy, the error message is being displayed when the libdart_ffi.so is absent in the library search path:

image

Also, the message has a nice copy button, and it works:

Exception: Failed to load libdart_ffi library: Invalid argument(s): Failed to load dynamic library 'libdart_ffi.so': libdart_ffi.so: cannot open shared object file: No such file or directory

The Exit application button also works.

The message disappears when I start the GUI with LD_LIBRARY_PATH: LD_LIBRARY_PATH=./build/lib ./build/bin/multipass.gui. Looks good to me, functionality-wise, will skim through the code with my non-existent Flutter knowledge :)

Copy link
Member

@xmkg xmkg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good job! Thanks for taking care of this one, @levkropp!

Copy link
Collaborator

@sharder996 sharder996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good now. Thanks for listening to my nitpicks @levkropp! 😄

@sharder996 sharder996 added this pull request to the merge queue Jul 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 7, 2025
@sharder996 sharder996 added this pull request to the merge queue Jul 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 7, 2025
@sharder996 sharder996 added this pull request to the merge queue Jul 8, 2025
Merged via the queue into main with commit fbf79e2 Jul 8, 2025
23 checks passed
@sharder996 sharder996 deleted the gui-libdart_ffi-not-found branch July 8, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GUI] Display a proper error message when "libdart_ffi" library fails to load

3 participants