Created attachment 8726 [details] [review] Bug 7857 - database upgrade fails with plack Updating database structure Update errors : Can't locate C4/Context.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 .) at /srv/koha/installer/data/mysql/updatedatabase.pl line 37. BEGIN failed--compilation aborted at /srv/koha/installer/data/mysql/updatedatabase.pl line 37. It seems that plack cleans enviroment, so we have to re-instart PERL5LIB so script invocation won't fail.
Created attachment 8729 [details] [review] Bug 7857 - database upgrade fails with plack Updating database structure Update errors : Can't locate C4/Context.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 .) at /srv/koha/installer/data/mysql/updatedatabase.pl line 37. BEGIN failed--compilation aborted at /srv/koha/installer/data/mysql/updatedatabase.pl line 37. It seems that plack cleans enviroment, so we have to re-instart PERL5LIB so script invocation won't fail. It also fixes exit 1 which fail with plack.
At end of upgrade you need to manually restart plack since C4::Context is keeping cache of sysprefs and database upgrade insert to new version from updatedatabase.pl get ignored. This will be fixed in separate bug.
Thats actually a general syspref issue it either needs to be a true global cache (shared between threads) or an external store like reddis or memcached. And flushed on change. There are quite a few gotchas like this.
This problem could be solved with simple Koha::SysPrefs which would wrap systempreferences table into intelligent caching. But rest of code would benefit from simple our $cache per-request cache which is safe from cache invalidation problems. Then we could start pushing it to memcache (after we flush all invalidation issues), but from my profiling so far, it seems biggest low-hanging fruit is caching within single request based on Bug 7177 This is next think I plan to work on, after all quirks with plack are cleaned up.
Created attachment 8912 [details] [review] Bug 7857 - invalidate cached preferences after SetVersion This allows plack to correctly move to login page after database upgrade
It turns out that we already have method to invoke cache invalidation so call to it is provided as second patch. I think this change is generally useful for all Koha versions, so I'm providing it as separate patch so it can be applied to older versions if needed.
Created attachment 9888 [details] [review] Bug 7857 - database upgrade fails with plack Updating database structure Update errors : Can't locate C4/Context.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 .) at /srv/koha/installer/data/mysql/updatedatabase.pl line 37. BEGIN failed--compilation aborted at /srv/koha/installer/data/mysql/updatedatabase.pl line 37. It seems that plack cleans enviroment, so we have to re-instart PERL5LIB so script invocation won't fail. It also fixes exit 1 which fail with plack. Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Patch Bug 7857 - database upgrade fails with plack signed off, please QA. The patch "Bug 7857 - invalidate cached preferences after SetVersion" should be put "in discussion". Plus there is a CHI cache management that should hit Koha very soon, that could make the discussion obsolete
I don't know if it's normal but I have another error : Can't locate InstallAuth.pm in @INC (@INC contains: /home/koha/src /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /home/koha/src/installer/install.pl line 7. BEGIN failed--compilation aborted at /home/koha/src/installer/install.pl line 7 (#1) I start plack like this: KOHA_CONF=/home/koha/etc/koha-conf.xml PERL5LIB=/home/koha/src; plackup --reload intranet.psgi --port=5001 I don't get this error if I start like: KOHA_CONF=/home/koha/etc/koha-conf.xml PERL5LIB=/home/koha/src:/home/koha/src/installer plackup --reload intranet.psgi --port=5001 But it it that we want ?
Replace last sentence with: But is it what we want ?
No, of course not :-) There is hidden -Iinstaller include in Bug 7844 - plack scripts for developers thanks for catching that!
Created attachment 10287 [details] [review] Bug 7857 - fix PERL5LIB followup This patch fixes PERL5LIB path injection to include installer dir which is required
Created attachment 10345 [details] [review] Bug 7857 - [SIGNED-OFF] database upgrade fails with plack This patch fixes PERL5LIB path injection to include installer dir which is required Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Last patch is trivial and makes sense. I passed QA these 3 patchs.
(In reply to comment #3) > At end of upgrade you need to manually restart plack since C4::Context is > keeping cache of sysprefs and database upgrade insert to new version from > updatedatabase.pl get ignored. > > This will be fixed in separate bug. Hi Dobrica, is this problem solved somewhere ? because it's still here...
(In reply to comment #16) > (In reply to comment #3) > > At end of upgrade you need to manually restart plack since C4::Context is > > keeping cache of sysprefs and database upgrade insert to new version from > > updatedatabase.pl get ignored. > > > > This will be fixed in separate bug. > > Hi Dobrica, > > is this problem solved somewhere ? because it's still here... Paul, You have to disable the syspref cache, as I made possible with bug 9005. There is no other way to deal with this at present. The solution -- to the extent that there is one -- is to use an update API (like in the non-linear updates bug) which handles syspref updating via C4::Context, and then if you're using a single-threaded Plack server it will work. As you know, it is my assertion that the syspref cache should always be disabled with PSGI.
Released in 3.10.0