https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17833 Bug ID: 17833 Summary: Memcached silently fails to _initilize_memcached() on the second time it is invoked Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: gmcharlt@gmail.com Reporter: olli-antti.kivilahti@jns.fi QA Contact: testopia@bugs.koha-community.org When _initilize_memcached() is called the first time, it sets the 'ismemcached'-key and returns 1. When _initilize_memcached() is called the second time, the 'ismemcached'-key already exists and '' is returned (this default to False in Perl). Koha thinks that memcached is not in use and decides to use some other caching mechanism instead. Cache::Memcached::Fast returns undef on server error: https://metacpan.org/pod/Cache::Memcached::Fast#add Koha MUST listen to undefined, instead of False to define whether or not memcached is properly working. Also added simple helpful diagnostics to help identify and log when this memcached server connection problem arises. Here is a small test run to verify this behaviour: root@kohadev:~# echo "fresh memcached start" fresh memcached start root@kohadev:~# perl l.pl 127.0.0.1:4545 1.4.14 (Ubuntu) def : '1' getkey: 'text' root@kohadev:~# echo "val already cached" val already cached root@kohadev:~# perl l.pl 127.0.0.1:4545 1.4.14 (Ubuntu) def : '' getkey: 'text' root@kohadev:~# echo "memcached killed and not responding" memcached killed and not responding root@kohadev:~# perl l.pl undef getkey: '' root@kohadev:~# echo "The return value is undefined" The return value is undefined root@kohadev:~# Here is the code snippet used to test the Memcached-server in the previous example output: kivilahtio@koha_ci_1 /h/k/Koha> cat t.pl use Cache::Memcached::Fast; use Modern::Perl; my $memd = new Cache::Memcached::Fast({ servers => [ '/lxcBindMount/tmp/memcached.sock' ], namespace => 'koha_ci_1:', connect_timeout => 0.2, io_timeout => 0.5, close_on_error => 1, max_failures => 3, failure_timeout => 2, ketama_points => 150, nowait => 1, hash_namespace => 1, }); # Get server versions. my $versions = $memd->server_versions; while (my ($server, $version) = each %$versions) { print "$server $version\n"; } # Store scalars. my $rv = $memd->add('skey', 'text'); print "undef\n" if not defined $rv; print "def : '$rv'\n" if defined $rv; print "getkey: '".$memd->get('skey')."'\n"; -- You are receiving this mail because: You are watching all bug changes.