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

makeLdLibraryPath and unpackLibraryBySoName purpose #3

Open
hey99xx opened this issue May 11, 2017 · 0 comments
Open

makeLdLibraryPath and unpackLibraryBySoName purpose #3

hey99xx opened this issue May 11, 2017 · 0 comments

Comments

@hey99xx
Copy link

hey99xx commented May 11, 2017

Minor documentation request

I am using SoLoader in a custom way in my app and I am prepending a new subclass of SoSource with SoLoader.prependSoSource.

I noticed SoSource class has methods addToLdLibraryPath called by SoLoader.makeLdLibraryPath, and unpackLibrary called by SoLoader.unpackLibraryAndDependencies, respectively.

I am confused about what's the purpose of these methods, and who's supposed to call them. I know React Native is a consumer of SoLoader project, but it doesn't even use these methods. Are these methods only for internal FB projects?

If I am unable to know the locations of the .so files (I am loading in an experimental way), but still able to load them in loadLibrary method, what's the best way to handle unpackLibrary method? Should I try ClassLoader.findLibrary methods that might work...

facebook-github-bot pushed a commit that referenced this issue May 5, 2023
Summary:
This diff caches the dependencies for all the shared lib which we load from directAPKSoSource. It helps to reduce the IO from `ZipFile` usage in DirectApkSoSource.

------------

For the below ANR, it access the ZipFile(apkPath) recursively. It might cause ANR if the the dependency chain is long.
https://www.internalfb.com/code/fbsource/[66bd4966e3cd7876df2bf6ca267344493ab6887a]/fbandroid/libraries/soloader/java/com/facebook/soloader/DirectApkSoSource.java?lines=160-166

https://www.internalfb.com/logview/system_vros_anrs/c5f4a8855d7901249f122159472d490f?trace_key=3c31184dcbf1afd1af5769a5e668cc53

{F975240488 width=1024px, height=300px}

```
Stacktrace for "pool-11-thread-1" prio=5 tid=43 Native

Stack Frame(File Name:Line)
- "pool-11-thread-1" prio=5 tid=43 Native
-   | group="main" sCount=1 ucsCount=0 flags=1 obj=0x145c0ef0 self=0x6ff27c5000
-   | sysTid=6823 nice=0 cgrp=default sched=0/0 handle=0x6fd84f8cb0
-   | state=S schedstat=( 323943396 1222271401 1831 ) utm=17 stm=14 core=1 HZ=100
-   | stack=0x6fd83f5000-0x6fd83f7000 stackSize=1039KB
-   | held mutexes=
-   native: #00 pc 000000000008576c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) (BuildId: 7e02c1ed07401e35df2848fc6da7e5b3)
-   native: #1 pc 000000000028b8f0  /apex/com.android.art/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+136) (BuildId: 85655b50adcce72ade5b9b80c24aac3a)
-   native: #2 pc 0000000000730820  /apex/com.android.art/lib64/libart.so (art::GoToRunnable(art::Thread*)+408) (BuildId: 85655b50adcce72ade5b9b80c24aac3a)
-   native: #3 pc 0000000000730ccc  /apex/com.android.art/lib64/libart.so (art::JniMethodEndWithReference(_jobject*, unsigned int, art::Thread*)+52) (BuildId: 85655b50adcce72ade5b9b80c24aac3a)
- java.util.zip.ZipFile.getEntryBytes (Native Method)
- java.util.zip.ZipFile.getZipEntry (ZipFile.java:635)
- java.util.zip.ZipFile.access$900 (ZipFile.java:64)
- java.util.zip.ZipFile$ZipEntryIterator.next (ZipFile.java:584)
-   - locked <0x082475cf> (a java.util.zip.ZipFile)
- java.util.zip.ZipFile$ZipEntryIterator.nextElement (ZipFile.java:559)
- java.util.zip.ZipFile$ZipEntryIterator.nextElement (ZipFile.java:540)
- com.facebook.soloader.DirectApkSoSource.loadDependencies (DirectApkSoSource.java:166) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadLibrary (DirectApkSoSource.java:76)
- com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:1165) [inlined]
- com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl (SoLoader.java:1045)
- com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:909) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadDependencies (DirectApkSoSource.java:174) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadLibrary (DirectApkSoSource.java:76)
- com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:1165) [inlined]
- com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl (SoLoader.java:1045)
- com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:909) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadDependencies (DirectApkSoSource.java:174) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadLibrary (DirectApkSoSource.java:76)
- com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:1165) [inlined]
- com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl (SoLoader.java:1045)
- com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:909) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadDependencies (DirectApkSoSource.java:174) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadLibrary (DirectApkSoSource.java:76)
- com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:1165) [inlined]
- com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl (SoLoader.java:1045)
- com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:909) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadDependencies (DirectApkSoSource.java:174) [inlined]
- com.facebook.soloader.DirectApkSoSource.loadLibrary (DirectApkSoSource.java:76)
- com.facebook.soloader.SoLoader.doLoadLibraryBySoName (SoLoader.java:1165) [inlined]
- com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl (SoLoader.java:1045)
- com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:924) [inlined]
- com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:870)
- com.facebook.soloader.NativeLoaderToSoLoaderDelegate.loadLibrary (NativeLoaderToSoLoaderDelegate.java:29)
- com.facebook.soloader.nativeloader.NativeLoader.loadLibrary (NativeLoader.java:52) [inlined]
- com.facebook.soloader.nativeloader.NativeLoader.loadLibrary (NativeLoader.java:30)
- com.facebook.mobileconfig.MobileConfigDependenciesInWearables.<clinit> (MobileConfigDependenciesInWearables.java:22)
- com.oculus.deviceconfigservice.MobileConfigServiceHelper.createMobileConfigManagerHolder (MobileConfigServiceHelper.java:163)
- com.facebook.mobileconfig.impl.MobileConfigDebugUtil$2.<init> (MobileConfigDebugUtil.java:247)
- com.facebook.mobileconfigservice.mobileconfigaccessor.MobileConfigAccessor._UL__ULSEP_com_facebook_mobileconfigservice_mobileconfigaccessor_MobileConfigAccessor_ULSEP_FACTORY_METHOD (MobileConfigAccessor.java:65) [inlined]
- com.facebook.ultralight.UL$factorymap0.get2 (UL.java:1604) [inlined]
- com.facebook.ultralight.UL$factorymap0.get (UL.java:1911)
- retrofit.mime.TypedFile.mimeType (TypedFile.java:57)
```

Reviewed By: adicatana

Differential Revision: D45591007

fbshipit-source-id: ffc8050638af85ded5fd5a34ecc5c5fea8bcde7b
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

No branches or pull requests

1 participant