Bugzilla – Attachment 35727 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]
[SIGNED OFF] Bug 13431 - Shared FastMmap file causes issues
SIGNED-OFF-Bug-13431---Shared-FastMmap-file-causes.patch (text/plain), 3.51 KB, created by
Katrin Fischer
on 2015-02-08 15:52:10 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 13431 - Shared FastMmap file causes issues
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-02-08 15:52:10 UTC
Size:
3.51 KB
patch
obsolete
>From 50f77f2f574f34b192e118d4df79f00a99397f44 Mon Sep 17 00:00:00 2001 >From: Jacek Ablewicz <abl@biblos.pk.edu.pl> >Date: Tue, 16 Dec 2014 12:48:09 +0100 >Subject: [PATCH] [SIGNED OFF] Bug 13431 - Shared FastMmap file causes issues > >Koha::Cache package does not take into account that, when using >fastmmap caching variant, mmaped cache file created in /tmp >(typically: /tmp/sharefile-koha-koha), would only be further >accessible to the one given OS user - the one which created it. >In many Koha setups, in the circumstances when various system scripts >are executed by 2+ users with diffrent UIDs (like multi-tenant servers, >for example) this may cause many kinds of issues. Observable symptom >is usually the appearance of the below error when searching, or looking >at MARC Framework pages and a few other places: > >Open of share file /tmp/sharefile-koha-koha failed: Permission denied >at /usr/lib/perl5/Cache/FastMmap.pm line 640. > >This patch: >- disables initialisation of fastmmap caching subsystem unless it is >explicitly requested by the user (CACHING_SYSTEM=fastmmap) >- disables fastmmap cache usage for command line scripts >(i.e. when GATEWAY_INTERFACE environment variable is not defined) >- adds the database name, host name and an ID of the OS user to the >mmaped file name created in /tmp, to prevent various kinds of >unintentional conflicts and/or permission problems from happening > >To test: > >1) remove the /tmp/sharefile-koha-* file[s] (if any) >2) do something which would lead to its re-creation (e.g., performing >any search in OPAC should be sufficient to cause that) >3) observe that /tmp/sharefile-koha-koha got created >4) remove it >5) apply patch >6) redo step 2) >7) observe that aforementioned file is no longer created in /tmp >8) set CACHING_SYSTEM environment variable to 'fastmmap' >9) redo step 2), observe that /tmp/sharefile-koha-* file got created >and that it's name now contains hostname, database name and UID >10) ensure that everything still works like it should and that there >are no regressions of any kinds anywhere in the system ;) > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Cache.pm | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > >diff --git a/Koha/Cache.pm b/Koha/Cache.pm >index 1638324..5611c52 100644 >--- a/Koha/Cache.pm >+++ b/Koha/Cache.pm >@@ -40,6 +40,7 @@ use warnings; > use Carp; > use Module::Load::Conditional qw(can_load); > use Koha::Cache::Object; >+use C4::Context; > > use base qw(Class::Accessor); > >@@ -90,10 +91,11 @@ sub new { > } > } > >- if ( can_load( modules => { 'Cache::FastMmap' => undef } ) ) { >+ if ( $self->{'default_type'} eq 'fastmmap' >+ && defined( $ENV{GATEWAY_INTERFACE} ) >+ && can_load( modules => { 'Cache::FastMmap' => undef } ) ) { > _initialize_fastmmap($self); >- if ( $self->{'default_type'} eq 'fastmmap' >- && defined( $self->{'fastmmap_cache'} ) ) >+ if ( defined( $self->{'fastmmap_cache'} ) ) > { > $self->{'cache'} = $self->{'fastmmap_cache'}; > } >@@ -159,9 +161,13 @@ 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' => "/tmp/sharefile-koha-$self->{'namespace'}", >+ 'share_file' => $share_file, > 'expire_time' => $self->{'timeout'}, > 'unlink_on_exit' => 0, > ); >-- >1.9.1
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