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

I think you may find issues with unloading and reloading #2

Closed
JeffVeit opened this issue May 10, 2023 · 1 comment
Closed

I think you may find issues with unloading and reloading #2

JeffVeit opened this issue May 10, 2023 · 1 comment

Comments

@JeffVeit
Copy link

Amongst plugin projects, the consensus seems to be that unloading and reloading is a hard problem.

The basic issues are:

  • Anything that is loaded may be unloaded at any time. Particularly in the case of multithreaded apps, this is difficult. Especially in library code which is not Rust, and you need to deal with errors whether catastrophic (oops the library went away) or minor (oops - exception!) in library code which may not be Rust.
  • On unloading you need to be sure that all memory used by the plugin is released before unloading: normally you would expect the library to outlive any data managed by the plugin.
  • Reloading or loading later versions has similar problems. I guess you might be able to arrange a system where data was not owned by the plugin, but the plugin manager, but in this case you'd need to know that any reloaded version had the same ABI for data structures. Or perhaps only support loading later versions upon the very first load, before the library has been used, rather than during use.

These projects have something to say about it:

I know that one of the plugin projects had a long discussion about the issues with unloading and reloading, but I don't think it's in the links above. My memory is that it was about loading C or C++ libraries, and that dlopen was basically a use-once per file function, and that you could never guarantee that dlclose would evict a previously loaded library. I don't think there was a satisfactory resolution, but tbf this is a pretty dim memory. Maybe you can find the discussion.

Again - I'm going to immediately close this issue since it's for info, rather than pointing out any actual problems.

@JeffVeit
Copy link
Author

That's all.

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