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

plugin incompatibility is not always detected #1745

Open
milyin opened this issue Jan 28, 2025 · 0 comments
Open

plugin incompatibility is not always detected #1745

milyin opened this issue Jan 28, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@milyin
Copy link
Contributor

milyin commented Jan 28, 2025

There are 2 problems in plugin compatibility detection:

  • information compared between plugin and zenohd (in get_vtable function) at this moment is not enough. It's not easy to implement full solution, but at least it makes sense to compare zenoh release version
  • list of features for compare listed in FEATURES global variable may not fully cover all features existing. There was a test to check this, but it seems to be removed. Need to recover the test or find other way to check validity of this list

The problems were found when fixing plugin crash in ts : eclipse-zenoh/zenoh-ts#109

More details about plugin compatibility detection:

Method DynamicPluginStarter::get_vtable compares structures Compatibility from plugin and from zenohd itself and refuses to load plugin dynamic library in case of incompatibility.
It compares

  • rust compiler version
  • versions of structures PluginVTable,type parameterStartArgs, and type parameter Instance where in zenohd case these type parameters are StartArgs=Runtime and Instance=RuntimePlugin:
     /// The zenoh plugins manager. It handles the full lifetime of plugins, from loading to destruction.
     pub type PluginsManager = zenoh_plugin_trait::PluginsManager<Runtime, RunningPlugin>;
    The version of structure is provided by trait StructVersion. Example:
impl StructVersion for Runtime {
    fn struct_version() -> u64 {
        1
    }
    fn struct_features() -> &'static str {
        crate::FEATURES
    }
}

The idea behind this test was that in case of breaking change the struct_version() should be bumped.

Unfortunately this doesn't always work: it's impossible to manually track all changes which may affect internals of the structure and make decision when to bump this version.

The proposed change is to make the struct_version return value string and by default return the zenoh release version in it. This will guarantee that plugins built with different release of zenoh will be rejected.

When API of Compatibility structure is changed, it's important to not forget to bump

pub const PLUGIN_LOADER_VERSION: PluginLoaderVersion = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant