pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
307 stars 447 forks source link

Increase resilience of the application against malfunctions on plugins #10514

Open jonasraoni opened 1 month ago

jonasraoni commented 1 month ago

Discussed in https://github.com/pkp/pkp-lib/discussions/9083

Originally posted by **jonasraoni** June 9, 2023 Given that any upgrade on the software has the power of breaking plugins, perhaps it makes sense to protect the application against errors on the plugins. Besides the `GatewayPlugin` (which have its own URL), plugins can also do real-time interventions through hooks/events and they might register themselves directly as callbacks somewhere across the codebase. It's possible to protect the plugin instantiation with a `try/catch` using a `Throwable` (catches fatal errors), and with some workarounds, the hook/events might be shielded as well, but if the plugin registers itself as a callback somewhere, there's not much we can do for now. Together with this, it's also needed to warn the administrator about the malfunctions, especially when it fails on the instantiation phase.
jonasraoni commented 1 month ago

On the hooks it might be interesting to flag which plugin failed to be executed.