Bug 23303

Summary: When uninstalling a plugin we don't call any form of 'unload'
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: Plugin architectureAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: dcook, kyle.m.hall, martin.renvoize, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31074
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Martin Renvoize (ashimema) 2019-07-11 12:55:39 UTC
We currently clean up the filesystem and run through the 'uninstall' method from the plugin in point during the uninstall process. We don't however, ever, unload the module code from memory and this may result in plack environments leaking memory.
Comment 1 David Cook 2023-12-14 23:24:00 UTC
(In reply to Martin Renvoize from comment #0)
> We currently clean up the filesystem and run through the 'uninstall' method
> from the plugin in point during the uninstall process. We don't however,
> ever, unload the module code from memory and this may result in plack
> environments leaking memory.

I don't think that this is possible in Perl though. 

In theory there's some things that can be down to unload the module (https://metacpan.org/pod/Class::Unload) but I don't know that it actually frees up any memory.

It would be interesting to do some experiments with it though...

Although it runs into the same problem as plugin upgrades. We'd need to signal it to all Starman workers.