[Koha-bugs] [Bug 10503] New: incorrect initialization parameters passed Memoize::Memcached

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jun 24 20:47:04 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10503

            Bug ID: 10503
           Summary: incorrect initialization parameters passed
                    Memoize::Memcached
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: gmcharlt at gmail.com
          Reporter: gmcharlt at gmail.com

Currently, Memoize::Memcached is initialized like this:

  eval {
      if (C4::Context->ismemcached) {
          require Memoize::Memcached;
          import Memoize::Memcached qw(memoize_memcached);

          memoize_memcached( 'GetMarcStructure',
                              memcached => C4::Context->memcached);
      }
  };

C4::Context->memcached returns a Cache::Memcached object.  However, that's not
what Memoize::Memcached expects:

  This function also accepts a memcached option, which expects a hashref. 
  This is de-referenced and passed directly into an internal function which
  sets up the memcached configuration for that function. This contents of this
  hashref are mostly options passed to Cache::Memcached, with a few exceptions.

However, passing a Cache::Memcached happened to work, by coincidence, as 
Memoize::Memcached was calling UNIVERSAL::isa (in a deprecated fashion [0]) to
check to see whether the passed argument is a HASH.

Nowadays, though, since UNIVERSAL->import is deprecated, the version of
Memoize::Memcached packaged for Debian Wheezy now uses ref() to check whether
the argument is a hash [1].  That means that the coincidence no longer works,
and consequently MARC frameworks don't get cached via memcached in Debian
Wheezy, leading to a performance degradation.

The solution is to pass Memoize::Memcached what it needs -- a hashref with the
Cache::Memcached arguments -- and not a Cache::Memcached object.

[0] https://rt.cpan.org/Public/Bug/Display.html?id=68170
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614868

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list