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

[Sofa.Helper] PluginManager: check if a plugin is already loaded with a different path #2352

Merged
merged 3 commits into from
Sep 29, 2021

Conversation

fredroy
Copy link
Contributor

@fredroy fredroy commented Sep 21, 2021

The case arises mostly because of running runSofa from a build directory but you set SOFA_ROOT. It will then tried to load plugins from the install afterwards, etc..., leading to stuff like:

[WARNING] [ObjectFactory] Default template for class DynamicSparseGridGeometryAlgorithms already registered (Vec3d), do not register Vec3d as the default
[WARNING] [ObjectFactory] Class already registered: DynamicSparseGridGeometryAlgorithms<Vec2d>
[WARNING] [ObjectFactory] Class already registered: DynamicSparseGridGeometryAlgorithms<Vec3d>
....

or with a cryptic error message if you try to use the PluginManager from the GUI:

[INFO]    [PluginManager] Plugin not found in loaded plugins: ..../bin/RelWithDebInfo/SofaNonUniformFem.dll
[ERROR]   [SofaPluginManager] plugin should be loaded: ..../bin/RelWithDebInfo/SofaNonUniformFem.dll

Now, if you try to load twice the plugins (from differents paths then), it will print:
(one dll is in build/bin/Release/ and the other one directly in build/

[WARNING] [PluginManager] This plugin SofaNonUniformFem has been loaded from a different path, it will certainly lead to bugs or crashes...
You tried to load: ....build/bin/Release/SofaNonUniformFem.dll
Already loaded: ....\build\SofaNonUniformFem.dll
[WARNING] [PluginManager] Plugin SofaNonUniformFem is already loaded from a different path, check you configuration.

The "double information" comes from the fact that in the end we consider the plugin as loaded ; the code afterwards will try to load the plugin nevertheless (hence having to detect twice the duplication)
In the GUI code for example:

if(sofa::helper::system::PluginManager::getInstance().loadPluginByPath(pluginFile,&sstream))

Obviously it is really not advised to continue to use Sofa if this case occurs but at least the user will know what is going on.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request labels Sep 21, 2021
@alxbilger
Copy link
Contributor

It will probably help to diagnose this issue #2338

fredroy and others added 2 commits September 23, 2021 11:25
…ager.cpp

Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>
@epernod
Copy link
Contributor

epernod commented Sep 27, 2021

"déjà vu", no ?
#1472

@fredroy
Copy link
Contributor Author

fredroy commented Sep 27, 2021

"déjà vu", no ?
#1472

I suppose #1472 was not working then 😬

@guparan guparan added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Sep 29, 2021
@epernod epernod merged commit 62e9edd into sofa-framework:master Sep 29, 2021
@guparan guparan added this to the v21.12 milestone Oct 1, 2021
damienmarchal pushed a commit to CRIStAL-PADR/sofa that referenced this pull request Oct 11, 2021
… a different path (sofa-framework#2352)

* add a check if plugin has already been loaded with a different path

* Update SofaKernel/modules/SofaHelper/src/sofa/helper/system/PluginManager.cpp

Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>

* fix compil

Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>
@fredroy fredroy deleted the update_helper_pluginmanager branch October 14, 2021 09:41
@guparan guparan added the pr: backport todo This PR will be backported into the release preceeding its milestone. label Oct 25, 2021
guparan pushed a commit that referenced this pull request Oct 25, 2021
… a different path (#2352)

* add a check if plugin has already been loaded with a different path

* Update SofaKernel/modules/SofaHelper/src/sofa/helper/system/PluginManager.cpp

Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>

* fix compil

Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>
guparan pushed a commit that referenced this pull request Oct 26, 2021
… a different path (#2352)

* add a check if plugin has already been loaded with a different path

* Update SofaKernel/modules/SofaHelper/src/sofa/helper/system/PluginManager.cpp

Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>

* fix compil

Co-authored-by: Alex Bilger <alxbilger@users.noreply.github.com>
@guparan guparan added pr: backport done This PR has been backported into the release before its milestone. and removed pr: backport todo This PR will be backported into the release preceeding its milestone. labels Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: backport done This PR has been backported into the release before its milestone. pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants