Bugzilla – Attachment 34826 Details for
Bug 13431
Shared FastMmap file causes issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13431 [QA Follow-up]: Shared FastMmap file causes issues
Bug-13431-QA-Follow-up-Shared-FastMmap-file-causes.patch (text/plain), 2.35 KB, created by
Jacek Ablewicz
on 2014-12-30 10:04:38 UTC
(
hide
)
Description:
Bug 13431 [QA Follow-up]: Shared FastMmap file causes issues
Filename:
MIME Type:
Creator:
Jacek Ablewicz
Created:
2014-12-30 10:04:38 UTC
Size:
2.35 KB
patch
obsolete
>From 06450d5a765ec0f671bd23e3c38cd7ae0e1cd561 Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Tue, 30 Dec 2014 10:30:30 +0100 >Subject: [PATCH] Bug 13431 [QA Follow-up]: Shared FastMmap file causes issues > >1) Removed 'use C4::Context;' because it can lead to introduction >of circular reference in the near future >2) Put fastmmap initialization code into an eval {} block, to catch >various kinds of errors which can still occur during it's init in >some [less usual] Koha setups and/or more unusual circumstances >3) Do not include UID in the sharefile name (it will be constructed >using namespace + database name + database host instead). > >Test plan addendum: > > s/and UID// >--- > Koha/Cache.pm | 33 ++++++++++++++++++++++----------- > 1 file changed, 22 insertions(+), 11 deletions(-) > >diff --git a/Koha/Cache.pm b/Koha/Cache.pm >index 5611c52..f4765b2 100644 >--- a/Koha/Cache.pm >+++ b/Koha/Cache.pm >@@ -40,7 +40,6 @@ use warnings; > use Carp; > use Module::Load::Conditional qw(can_load); > use Koha::Cache::Object; >-use C4::Context; > > use base qw(Class::Accessor); > >@@ -161,16 +160,28 @@ sub _initialize_memcached { > > sub _initialize_fastmmap { > my ($self) = @_; >- my $share_file = join( '-', >- "/tmp/sharefile-koha", $self->{'namespace'}, >- C4::Context->config('hostname'), C4::Context->config('database'), >- "" . getpwuid($>) ); >- >- $self->{'fastmmap_cache'} = Cache::FastMmap->new( >- 'share_file' => $share_file, >- 'expire_time' => $self->{'timeout'}, >- 'unlink_on_exit' => 0, >- ); >+ my ($cache, $share_file); >+ >+ # Temporary workaround to catch fatal errors when: C4::Context module >+ # is not loaded beforehand, or Cache::FastMmap init fails for whatever >+ # other reason (e.g. due to permission issues - see Bug 13431) >+ eval { >+ $share_file = join( '-', >+ "/tmp/sharefile-koha", $self->{'namespace'}, >+ C4::Context->config('hostname'), C4::Context->config('database') ); >+ >+ $cache = Cache::FastMmap->new( >+ 'share_file' => $share_file, >+ 'expire_time' => $self->{'timeout'}, >+ 'unlink_on_exit' => 0, >+ ); >+ }; >+ if ( $@ ) { >+ warn "FastMmap cache initialization failed: $@"; >+ return; >+ } >+ return unless defined $cache; >+ $self->{'fastmmap_cache'} = $cache; > return $self; > } > >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13431
:
34321
|
34323
|
34453
|
34826
|
35726
|
35727
|
35728
|
35823
|
35824