Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to a fully qualified path to libapp.so if the library can not be loaded by name #9762

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

jason-simmons
Copy link
Member

libapp.so contains compiled application Dart code. On most Android systems,
this library can be loaded by calling dlopen("libapp.so"), which will search
Android's default library directories.

On some Android devices this does not work as expected. As a workaround, this
patch provides a fallback path to libapp.so based on ApplicationInfo.nativeLibraryDir.

Fixes flutter/flutter#35838

Copy link

@blasten blasten left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this 👍

…ot be loaded by name

libapp.so contains compiled application Dart code.  On most Android systems,
this library can be loaded by calling dlopen("libapp.so"), which will search
Android's default library directories.

On some Android devices this does not work as expected.  As a workaround, this
patch provides a fallback path to libapp.so based on ApplicationInfo.nativeLibraryDir.

Fixes flutter/flutter#35838
Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

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

Didn't fully qualifying it pose problems before when the shared library was still in the zip archive?

@jason-simmons
Copy link
Member Author

Yes - loading with dlopen("libapp.so") is preferred because it handles cases like searching within a zip file. This patch tries that first and then falls back to the nativeLibraryDir based path if that doesn't work.

@tvolkert
Copy link
Contributor

Does this really fix the case of the bug report then, since isn't libapp.so still compressed in the bug report case?

@jason-simmons
Copy link
Member Author

This is intended as a workaround for a specific old Android device where calling dlopen with an unqualified name does not produce the same results as standard Android devices. The affected device is running a variant of Jellybean and predates support for loading libraries directly out of a ZIP file.

@tvolkert
Copy link
Contributor

Gotcha. LGTM.

@jason-simmons jason-simmons merged commit 3c9a22c into flutter:master Jul 11, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 11, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 11, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Jul 11, 2019
flutter/engine@3b94410...bcde838

git log 3b94410..bcde838 --no-merges --oneline
bcde838 Roll Wuffs and buildroot (flutter/engine#9791)
3b75979 fix ColorFilter.matrix constness (flutter/engine#9789)
3c9a22c Fall back to a fully qualified path to libapp.so if the library can not be loaded by name (flutter/engine#9762)
298a610 Roll fuchsia/sdk/core/mac-amd64 from XOXaWqvr4OuJ6O3uPefSwSFjZMaEmDHy5JQm3Q8Oc0wC to CDbRdGJ3bu-aWMCZqN5VzfQqIBwDGL2wfFodWABKdCIC (flutter/engine#9790)
833f6b4 Roll src/third_party/skia f9fcf7ffa89a..7825d4983f90 (6 commits) (flutter/engine#9788)
1250c37 Add comments to differentiate two cache paths (flutter/engine#9721)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff (garyq@google.com), and stop
the roller if necessary.
@tvolkert
Copy link
Contributor

Can we add a test for this?

@jason-simmons
Copy link
Member Author

We could add a device with this issue to the device lab. For unit tests, there's an ongoing discussion about how to test Java embedding code that relies on Android APIs.

@blasten
Copy link

blasten commented Jul 12, 2019

I just checked the Firebase device farm and the lowest Android version they have is 4.3.x. Maybe that version still reproduces the issue.

jason-simmons added a commit to jason-simmons/flutter_engine that referenced this pull request Jul 17, 2019
dlopen errors are expected behavior when locating libapp.so on some older
Android devices (see flutter#9762)
jason-simmons added a commit that referenced this pull request Jul 17, 2019
dlopen errors are expected behavior when locating libapp.so on some older
Android devices (see #9762)
tvolkert pushed a commit to tvolkert/engine that referenced this pull request Jul 17, 2019
…ot be loaded by name (flutter#9762)

libapp.so contains compiled application Dart code.  On most Android systems,
this library can be loaded by calling dlopen("libapp.so"), which will search
Android's default library directories.

On some Android devices this does not work as expected.  As a workaround, this
patch provides a fallback path to libapp.so based on ApplicationInfo.nativeLibraryDir.

Fixes flutter/flutter#35838
tvolkert pushed a commit to tvolkert/engine that referenced this pull request Jul 17, 2019
dlopen errors are expected behavior when locating libapp.so on some older
Android devices (see flutter#9762)
tvolkert pushed a commit that referenced this pull request Jul 17, 2019
…ot be loaded by name (#9762)

libapp.so contains compiled application Dart code.  On most Android systems,
this library can be loaded by calling dlopen("libapp.so"), which will search
Android's default library directories.

On some Android devices this does not work as expected.  As a workaround, this
patch provides a fallback path to libapp.so based on ApplicationInfo.nativeLibraryDir.

Fixes flutter/flutter#35838
tvolkert pushed a commit that referenced this pull request Jul 17, 2019
dlopen errors are expected behavior when locating libapp.so on some older
Android devices (see #9762)
tvolkert added a commit to tvolkert/flutter that referenced this pull request Jul 18, 2019
tvolkert added a commit to flutter/flutter that referenced this pull request Jul 18, 2019
@kf6gpe
Copy link
Contributor

kf6gpe commented Jul 22, 2019

This PR has been merged into a hotfix candidate, 1.7.8+hotfix.4, currently in the beta channel. If it soaks well, we anticipate pushing this to stable soon.

@angel1st
Copy link

Thanks, @kf6gpe - I can confirm 1.7.8+hotfix.4 works pretty well and in fact it also does not have the crash currently introduced into master channel.

johnsonmh pushed a commit to johnsonmh/flutter that referenced this pull request Jul 30, 2019
flutter/engine@3b94410...bcde838

git log 3b94410..bcde838 --no-merges --oneline
bcde838 Roll Wuffs and buildroot (flutter/engine#9791)
3b75979 fix ColorFilter.matrix constness (flutter/engine#9789)
3c9a22c Fall back to a fully qualified path to libapp.so if the library can not be loaded by name (flutter/engine#9762)
298a610 Roll fuchsia/sdk/core/mac-amd64 from XOXaWqvr4OuJ6O3uPefSwSFjZMaEmDHy5JQm3Q8Oc0wC to CDbRdGJ3bu-aWMCZqN5VzfQqIBwDGL2wfFodWABKdCIC (flutter/engine#9790)
833f6b4 Roll src/third_party/skia f9fcf7ffa89a..7825d4983f90 (6 commits) (flutter/engine#9788)
1250c37 Add comments to differentiate two cache paths (flutter/engine#9721)

The AutoRoll server is located here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md

If the roll is causing failures, please contact the current sheriff (garyq@google.com), and stop
the roller if necessary.
jiahaog added a commit to jiahaog/flutter-engine that referenced this pull request Apr 25, 2023
As the Engine uses `dlopen` to find the `libapp.so`, flutter/flutter#59834 can happen which will prevent `dlopen` from finding the binary. In theory this should be mitigated by flutter#9762, but an internal customer observed errors where `dlopen` is not found. 

The additional logging here can help to rule out that hypothesis. For Googlers, see b/276657840 for more details.
auto-submit bot pushed a commit that referenced this pull request Apr 26, 2023
As the Engine uses `dlopen` to find the `libapp.so`, flutter/flutter#59834 can happen which will prevent `dlopen` from finding the binary. In theory this should be mitigated by #9762, but an internal customer observed errors that could be related. 

The additional logging here can help to rule out that hypothesis. For Googlers, see b/276657840 for more details.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
7 participants