facebook / SoLoader

Native code loader for Android
Apache License 2.0
1.34k stars 175 forks source link

Only Initializing SoLoader Once Broke Dynamic Feature Module. #101

Open gedeagas opened 2 years ago

gedeagas commented 2 years ago

https://github.com/facebook/SoLoader/commit/3b241005a2226aca68d73853c2eaf56d1304e5c0

This commit checks if SoLoaders have been loaded once via

if (sSoSources != null) {
      return true;
}

But this broke DFM functionality. let's imagine that we have SoLoader init call on MainApplication. Then the user download a DFM module with multiple .so files packed inside the DFM module, when we call SoLoader.init again on DFM module so loader will not load and search .so files inside DFM module and instead do nothing.

cc @simpleton .

simpleton commented 2 years ago

Do you have a reproduction? this only tries to prevent multiple init on the SoLoader side. the soSource updated should be handled by sSoSourcesVersion .

On Fri, May 20, 2022 at 11:48 AM Agastya Darma @.***> wrote:

3b24100 https://github.com/facebook/SoLoader/commit/3b241005a2226aca68d73853c2eaf56d1304e5c0

This commit checks if SoLoaders have been loaded once via

if (sSoSources != null) { return true; }

But this broke DFM functionality. let's imagine that we have SoLoader init call on MainApplication. Then the user download a DFM module with multiple .so files packed inside the DFM module, when we call SoLoader.init again on DFM module so loader will not load and search .so files inside DFM module and instead do nothing.

cc @simpleton https://github.com/simpleton .

— Reply to this email directly, view it on GitHub https://github.com/facebook/SoLoader/issues/101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADO6YTA4HHYT2M3MGRMBETVK7NBHANCNFSM5WQI7BQQ . You are receiving this because you were mentioned.Message ID: @.***>

gedeagas commented 2 years ago

Hi thank you for the quick reply @simpleton. When we are debugging it earlier, the .so files inside DFM module never getting picked up when we call SoLoader.init for the second time inside a DFM module.

Maybe this is the intended behaviours of so loader?. If this is indeed the intended behaviours how can we update the soSource so that it will also include all the so.files inside DFM? we make a quick and dirty fix to solve this problem by removing all the sSoSources != null check. But maybe this "hack" is not the best way to do this. do you have any suggestion?

gedeagas commented 1 year ago

Hi @simpleton sorry for bothering you again. What's exactly is the proper way to update the soSource? Because of DFM i need to init SoLoader again on the DFM module in order to update the soSource, is there any other way?