[Bug 25778] New: koha-plack --restart causes PERL5LIB to grow with duplicate entries
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Bug ID: 25778 Summary: koha-plack --restart causes PERL5LIB to grow with duplicate entries Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Packaging Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org CC: mtj@kohaaloha.com Line 395 in koha-lack "PERL5LIB=$PERL5LIB:$KOHA_HOME/installer:$KOHA_HOME/lib/installer" causes PERL5LIB to grow with duplicate entries for /usr/share/koha/installer and /usr/share/koha/lib/installer when running in production. Note that this does *not* happen when running in dev, when using koha-testing-docker for instance. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- This is how my @INC looks like on one instance: /usr/share/koha/lib /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /usr/share/koha/installer /usr/share/koha/lib/installer /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 105934 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105934&action=edit Bug 25778: Remove install lib dir from PERL5LIB to prevent dup In a non dev environment, PERL5LIB will contain duplicate of $KOHA_HOME/installer and $KOHA_HOME/installer/lib To prevent that we remove them before appending them. Test plan: Try the code in a shell and confirm that it works as expected. Note: it does not happend in dev because adjust_paths_dev_install reset PERL5LIB to KOHA_HOME -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Assignee|koha-bugs@lists.koha-commun |jonathan.druart@bugs.koha-c |ity.org |ommunity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #3 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I don't understand why they accumulate. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi from comment #3)
I don't understand why they accumulate.
The more I think about it, the less I understand as well. I think that I was wrong about it being due to "koha-plack --restart". I'm looking at a Koha instance where the server was rebooted last night, but it has 46 pairs of /usr/share/koha/installer and /usr/share/koha/lib/installer. There is no way that koha-plack was restarted 45 times since last night. Interestingly, if I try to cat /proc/<starman PID>/environ, I just get a long blank response with no actual environmental variables inside. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #5 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi from comment #3)
I don't understand why they accumulate.
Oh wait I see it now. It's so obvious in retrospect. Look at the scoping of PERL5LIB in the following block of code: if [ $# -gt 0 ]; then # We have at least one instance name for name in "$@"; do if is_instance $name; then adjust_paths_dev_install $name export DEV_INSTALL export KOHA_HOME PERL5LIB=$PERL5LIB:$KOHA_HOME/installer:$KOHA_HOME/lib/installer If you're specifying more than 1 instance name to koha-plack, it'll append "$KOHA_HOME/installer:$KOHA_HOME/lib/installer" to PERL5LIB for each instance. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|koha-plack --restart causes |koha-plack puts duplicate |PERL5LIB to grow with |entries into PERL5LIB when |duplicate entries |multiple instances named -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- So we need to solve it with right scoping. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #7 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi from comment #6)
So we need to solve it with right scoping.
Exactly. The following snippet provides a model that should work: export THIS test_function() { local THIS=blah echo `env` } test_function echo $THIS -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #8 from David Cook <dcook@prosentient.com.au> --- Or better yet... THIS=ONE export THIS test_function() { local THIS=blah echo `env` } test_function echo $THIS -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #9 from David Cook <dcook@prosentient.com.au> --- I don't have time to write a patch right now, but I reckon we mark PERL5LIB as an export above the per-instance loop, move the per-instance logic into a function, and localize PERL5LIB within the function. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #10 from David Cook <dcook@prosentient.com.au> --- (In reply to David Cook from comment #9)
I don't have time to write a patch right now, but I reckon we mark PERL5LIB as an export above the per-instance loop, move the per-instance logic into a function, and localize PERL5LIB within the function.
Ok maybe just one quick patch... but I won't exhaustively test it right now.. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #11 from David Cook <dcook@prosentient.com.au> --- Created attachment 108221 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108221&action=edit Bug 25778: [Alternate patch] Fix var scope in koha-plack for PERL5LIB and KOHA_HOME Currently, if a koha-plack is given multiple instances, it will create duplicate $KOHA_HOME/installer and $KOHA_HOME/installer/lib entries in PERL5LIB as these changes are done at the global rather than local level. This issue can only be seen in non-dev Koha, since dev Koha installs rewrite PERL5LIB. This patch localizes PERL5LIB to each instance. To test dev installs: 0. cp debian/scripts/koha-plack /usr/sbin/koha-plack 1. koha-plack --restart kohadev 2. Note that nothing breaks To test non-dev installs: 0. Don't replace /usr/sbin/koha-plack yet 1. Create multiple non-dev installs with plack enabled and running 2. Set up one of these non-dev installs so you can use the web UI (that is beyong the scope of this test plan) 3. koha-plack --restart test1 test2 test3 4. For test3, go to /cgi-bin/koha/about.pl 5. Note that there are duplicate /usr/share/koha/installer and /usr/share/koha/lib/installer entries in PERL5LIB 6. cp debian/scripts/koha-plack /usr/sbin/koha-plack 7. koha-plack --restart test1 test2 test3 8. For test3, go to /cgi-bin/koha/about.pl 9. Note that there are no duplicates entries in PERL5LIB -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #12 from David Cook <dcook@prosentient.com.au> --- It would be good to have someone with debugger knowledge (I think that's you, Tomas?) to test my patch. I just tested it with --enable, --start, and --restart -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105934|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|jonathan.druart@bugs.koha-c |dcook@prosentient.com.au |ommunity.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |master --- Comment #13 from Tomás Cohen Arazi <tomascohen@gmail.com> --- This should be backported down to 19.11 once we agree on the fix. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108221|0 |1 is obsolete| | --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 108290 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108290&action=edit Bug 25778: Fix var scope in koha-plack for PERL5LIB and KOHA_HOME Currently, if a koha-plack is given multiple instances, it will create duplicate $KOHA_HOME/installer and $KOHA_HOME/installer/lib entries in PERL5LIB as these changes are done at the global rather than local level. This issue can only be seen in non-dev Koha, since dev Koha installs rewrite PERL5LIB. This patch localizes PERL5LIB to each instance. To test dev installs: 0. cp debian/scripts/koha-plack /usr/sbin/koha-plack 1. koha-plack --restart kohadev 2. Note that nothing breaks To test non-dev installs: 0. Don't replace /usr/sbin/koha-plack yet 1. Create multiple non-dev installs with plack enabled and running 2. Set up one of these non-dev installs so you can use the web UI (that is beyong the scope of this test plan) 3. koha-plack --restart test1 test2 test3 4. For test3, go to /cgi-bin/koha/about.pl 5. Note that there are duplicate /usr/share/koha/installer and /usr/share/koha/lib/installer entries in PERL5LIB 6. cp debian/scripts/koha-plack /usr/sbin/koha-plack 7. koha-plack --restart test1 test2 test3 8. For test3, go to /cgi-bin/koha/about.pl 9. Note that there are no duplicates entries in PERL5LIB Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- David's plugin does the job. I tested on a kohadevbox and printing the PERL5LIB value. REmote debugging works as expected. About the question on the FIXME, remote debugging won't work with multiple instances at a time, I wouldn't worry about that now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |26163 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26163 [Bug 26163] Add plugin directories to PERL5LIB -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #16 from David Cook <dcook@prosentient.com.au> --- (In reply to Tomás Cohen Arazi from comment #15)
David's plugin does the job. I tested on a kohadevbox and printing the PERL5LIB value.
REmote debugging works as expected. About the question on the FIXME, remote debugging won't work with multiple instances at a time, I wouldn't worry about that now.
Thanks for testing that, Tomas! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #108290|0 |1 is obsolete| | --- Comment #17 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 108472 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108472&action=edit Bug 25778: Fix var scope in koha-plack for PERL5LIB and KOHA_HOME Currently, if a koha-plack is given multiple instances, it will create duplicate $KOHA_HOME/installer and $KOHA_HOME/installer/lib entries in PERL5LIB as these changes are done at the global rather than local level. This issue can only be seen in non-dev Koha, since dev Koha installs rewrite PERL5LIB. This patch localizes PERL5LIB to each instance. To test dev installs: 0. cp debian/scripts/koha-plack /usr/sbin/koha-plack 1. koha-plack --restart kohadev 2. Note that nothing breaks To test non-dev installs: 0. Don't replace /usr/sbin/koha-plack yet 1. Create multiple non-dev installs with plack enabled and running 2. Set up one of these non-dev installs so you can use the web UI (that is beyong the scope of this test plan) 3. koha-plack --restart test1 test2 test3 4. For test3, go to /cgi-bin/koha/about.pl 5. Note that there are duplicate /usr/share/koha/installer and /usr/share/koha/lib/installer entries in PERL5LIB 6. cp debian/scripts/koha-plack /usr/sbin/koha-plack 7. koha-plack --restart test1 test2 test3 8. For test3, go to /cgi-bin/koha/about.pl 9. Note that there are no duplicates entries in PERL5LIB Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 --- Comment #18 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.11.00 |20.11.00, 20.05.04 released in| | Status|Pushed to master |Pushed to stable CC| |lucas@bywatersolutions.com --- Comment #19 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 20.05.x for 20.05.04 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aleisha@catalyst.net.nz Version(s)|20.11.00, 20.05.04 |20.11.00, 20.05.04, released in| |19.11.10 Status|Pushed to stable |Pushed to oldstable --- Comment #20 from Aleisha Amohia <aleisha@catalyst.net.nz> --- backported to 19.11.x for 19.11.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25778 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net --- Comment #21 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org