Bugzilla – Attachment 164660 Details for
Bug 30897
Gracefully reload Koha after plugin install/upgrade
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30897: Gracefully restart plack after plugin install/remove
Bug-30897-Gracefully-restart-plack-after-plugin-in.patch (text/plain), 2.41 KB, created by
Martin Renvoize (ashimema)
on 2024-04-11 08:37:54 UTC
(
hide
)
Description:
Bug 30897: Gracefully restart plack after plugin install/remove
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-11 08:37:54 UTC
Size:
2.41 KB
patch
obsolete
>From b8d8bd2083597bf9e9e0dfd6cb927e260d9758f9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 10 Apr 2024 10:54:48 +0200 >Subject: [PATCH] Bug 30897: Gracefully restart plack after plugin > install/remove > >This patch adds a graceful plack restart to the plugin >install/uninstall routine to fully allow plugin install to work via the >staff client. > >Test plan >1. list your worker processes with something like htop >2. install a plugin > https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases >3. note that the PIDs of the workers stay the same and no sign of > restart (no PID changes and no CPU activity that the workers would > have if they were starting) >4. apply patches and restart services >5. unistall plugin >6. notice worker restart >7. install plugin >8. notice worker restart >9. downgrade plugin >10. notice worker restart >11. upgrade plugin >12. notice worker restart >13. disable and enable plugin >14. *no restart* > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > Koha/Plugins.pm | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index d93e9fe40fc..94ff5e991a5 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -26,6 +26,7 @@ use Module::Load::Conditional qw( can_load ); > use Module::Load; > use Module::Pluggable search_path => ['Koha::Plugin'], except => qr/::Edifact(|::Line|::Message|::Order|::Segment|::Transport)$/; > use Try::Tiny; >+use POSIX qw(getpid); > > use C4::Context; > use C4::Output; >@@ -312,6 +313,8 @@ sub InstallPlugins { > > Koha::Cache::Memory::Lite->clear_from_cache(ENABLED_PLUGINS_CACHE_KEY); > >+ $self->_restart_after_change(); >+ > return @plugins; > } > >@@ -354,6 +357,24 @@ sub RemovePlugins { > Koha::Plugins::Datas->search($cond)->update( { plugin_value => 0 } ); > Koha::Cache::Memory::Lite->clear_from_cache( Koha::Plugins->ENABLED_PLUGINS_CACHE_KEY ); > } >+ >+ $class->_restart_after_change(); >+} >+ >+sub _restart_after_change { >+ my ( $class, $params ) = @_; >+ >+ my $parent_pid = getpid(); >+ my $ppid = getppid(); # Get the parent process ID >+ >+ # If the current process is not Plack parent, find the parent process recursively >+ while ($parent_pid != $ppid) { >+ $parent_pid = $ppid; >+ $ppid = getppid(); >+ } >+ >+ # Send SIGUSR1 signal to Plack parent process for graceful restart >+ kill 'HUP', $parent_pid; > } > > 1; >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30897
:
164587
|
164588
|
164654
|
164655
|
164657
|
164658
|
164660
|
164661
|
164662
|
164663
|
164735
|
164736
|
164737
|
164738
|
164758