Bug 11842 - MARC framework editing is broken when memcache is enabled
Summary: MARC framework editing is broken when memcache is enabled
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Robin Sheat
QA Contact: Testopia
URL:
Keywords:
Depends on: 12041
Blocks: 12173 12800 13431 16955
  Show dependency treegraph
 
Reported: 2014-02-26 06:28 UTC by Bob Birchall
Modified: 2016-08-01 12:06 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11842 - fix framework caching with memcache/plack (9.39 KB, patch)
2014-04-10 05:15 UTC, Robin Sheat
Details | Diff | Splinter Review
Bug 11842 - fix framework caching with memcache/plack (9.60 KB, patch)
2014-04-10 05:18 UTC, Robin Sheat
Details | Diff | Splinter Review
[signed off] Bug 11842 - fix framework caching with memcache/plack (9.67 KB, patch)
2014-05-21 23:02 UTC, Brendan Gallagher
Details | Diff | Splinter Review
Bug 11842 - fix framework caching with memcache/plack (9.72 KB, patch)
2014-07-21 09:18 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Birchall 2014-02-26 06:28:02 UTC
With memcache enabled, when the value of the Editor parameter in a MARC framework is changed, the change is not reflected in the framework as presented in the Cataloguing module.  The problem is resolved by disabling memcache.

To prove:
Enable memcache.
Select Administration / MARC bibliographic framework / Default framework : click on MARC structure
For tag 015, click on Subfields :  note there are four subfields, of which 2 and a are not 'hidden' but 6 and 8 are 'hidden'.
Click Edit Subfields and for subfield 8, Display More Constraints; note the Visibility line:
OPAC checked (show)
Intranet checked (show)
Editor not checked (don't show)
Collapsed not checked (show the non-hidden subfields, don't collapse to show the tag only)

Go to the data base and select the marc_subfield_structure table.  Observe that for tagfield 015, tagsubfield 8 and frameworkcode '  ' the value of 'hidden' is -6.  This is correct.  We understand that if the value is -6 then the subfield is not shown in the editor.

This can be confirmed by going to the cataloguing module, selecting New Record and Default framework.  Check tag 015 - subfield 8 is not displayed.

Now edit subfield 8 and set Editor to 'checked'.  Return to the data base and confirm that 015 subfield 8 for the default framework now has 'Hidden' set to 0 (zero).  Subfield 8 should now display in the cataloguing editor.

Return to the /cataloguing editor and confirm that subfield 8 is not displayed.

Disabling memcache resolves the problem.
Comment 1 Robin Sheat 2014-04-10 03:28:10 UTC
There's two levels of caching happening, memoisation and an in process cache. Both must go.
Comment 2 Robin Sheat 2014-04-10 05:15:19 UTC Comment hidden (obsolete)
Comment 3 Robin Sheat 2014-04-10 05:18:05 UTC Comment hidden (obsolete)
Comment 4 Brendan Gallagher 2014-05-21 23:02:04 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2014-07-20 20:38:37 UTC
I haven't tried using memcache/caching in ages. What's required to set it up on a git dev installation?
Comment 6 Robin Sheat 2014-07-20 23:46:39 UTC
(In reply to Katrin Fischer from comment #5)
> I haven't tried using memcache/caching in ages. What's required to set it up
> on a git dev installation?

Install memcache and then add some SetEnv lines to your apache config, e.g.

   SetEnv MEMCACHED_SERVERS 127.0.0.1:11211
   SetEnv MEMCACHED_NAMESPACE koha

make sure memcached is actually running, and it should just start working.

There's a script that comes with memcache that lets you dump all its contents which is handy to see that it's actually being used.
Comment 7 Jonathan Druart 2014-07-21 09:18:38 UTC
Created attachment 29917 [details] [review]
Bug 11842 - fix framework caching with memcache/plack

This changes the existing framework caching, which was using memoisation
if memcached was available, and memory in all cases, to use the
Koha::Cache system. This uses memcache if possible, and in-memory
otherwise. However it also clears the cache when the framework updates,
making sure that the changed version will be picked up.

Note that the in-memory cache clears itself after 10 seconds, so that if
memcached isn't available, this is the longest that old versions will
hang around.

Test plan:
* work through
  http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11842#c0
  and make sure that the erronious result doesn't occur.

Note:
* The patch on bug 12041 is required for this to work.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
I confirm the issue and that this patch fixes it!
Comment 8 Tomás Cohen Arazi 2014-07-22 14:46:31 UTC
Is this bug present in current maste ror just 3.12? Also, does it affect any setup or just Plack?
Comment 9 Jonathan Druart 2014-07-22 15:04:33 UTC
(In reply to Tomás Cohen Arazi from comment #8)
> Is this bug present in current maste ror just 3.12? Also, does it affect any
> setup or just Plack?

I tested on master. I didn't reproduce the issue without Plack OR Memcache.
Comment 10 Tomás Cohen Arazi 2014-08-19 15:55:08 UTC
Patch pushed to master.

Thanks Robin!
Comment 11 Katrin Fischer 2014-08-21 07:30:53 UTC
I think this might have an unwanted side effect. When trying to access my MARC bibliographic frameworks from administration, following erros is shown:

Open of share file /tmp/sharefile-koha-koha failed: Permission denied at /usr/lib/perl5/Cache/FastMmap.pm line 640.
Comment 12 Katrin Fischer 2014-08-21 07:31:24 UTC
I haven't set up caching or anything.