r63240 - in /branches/upstream/libcache-fastmmap-perl/current: Cache-FastMmap-CImpl/CImpl.pm Cache-FastMmap-CImpl/mmap_cache.c Cache-FastMmap-CImpl/mmap_cache_internals.h Cache-FastMmap-CImpl/unix.c Changes FastMmap.pm META.yml t/14.t t/6.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Oct 3 19:11:33 UTC 2010


Author: jawnsy-guest
Date: Sun Oct  3 19:11:24 2010
New Revision: 63240

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=63240
Log:
[svn-upgrade] new version libcache-fastmmap-perl (1.36)

Modified:
    branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm
    branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c
    branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache_internals.h
    branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/unix.c
    branches/upstream/libcache-fastmmap-perl/current/Changes
    branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm
    branches/upstream/libcache-fastmmap-perl/current/META.yml
    branches/upstream/libcache-fastmmap-perl/current/t/14.t
    branches/upstream/libcache-fastmmap-perl/current/t/6.t

Modified: branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/CImpl.pm Sun Oct  3 19:11:24 2010
@@ -15,7 +15,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.35';
+our $VERSION = '1.36';
 
 require XSLoader;
 XSLoader::load('Cache::FastMmap::CImpl', $VERSION);

Modified: branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache.c Sun Oct  3 19:11:24 2010
@@ -57,6 +57,7 @@
   cache->init_file = def_init_file;
   cache->test_file = def_test_file;
 
+  cache->catch_deadlocks = 0;
   cache->enable_stats = 0;
 
   cache->last_error = 0;
@@ -79,6 +80,8 @@
     cache->share_file = val;
   } else if (!strcmp(param, "start_slots")) {
     cache->start_slots = atoi(val);
+  } else if (!strcmp(param, "catch_deadlocks")) {
+    cache->catch_deadlocks = atoi(val);
   } else if (!strcmp(param, "enable_stats")) {
     cache->enable_stats = atoi(val);
   } else {

Modified: branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache_internals.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache_internals.h?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache_internals.h (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/mmap_cache_internals.h Sun Oct  3 19:11:24 2010
@@ -42,6 +42,7 @@
   /* Cache general details */
   MU32    start_slots;
   MU32    expire_time;
+  int     catch_deadlocks;
   int     enable_stats;
 
   /* Share mmap file details */

Modified: branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/unix.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/unix.c?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/unix.c (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Cache-FastMmap-CImpl/unix.c Sun Oct  3 19:11:24 2010
@@ -147,7 +147,8 @@
   lock.l_start = p_offset;
   lock.l_len = cache->c_page_size;
 
-  old_alarm = alarm(alarm_left);
+  if (cache->catch_deadlocks)
+    old_alarm = alarm(alarm_left);
 
   while (lock_res != 0) {
 
@@ -156,22 +157,26 @@
 
     /* Continue immediately if success */
     if (lock_res == 0) {
-      alarm(old_alarm);
+      if (cache->catch_deadlocks)
+        alarm(old_alarm);
       break;
     }
 
     /* Turn off alarm for a moment */
-    alarm_left = alarm(0);
+    if (cache->catch_deadlocks)
+      alarm_left = alarm(0);
 
     /* Some signal interrupted, and it wasn't the alarm? Rerun lock */
     if (lock_res == -1 && errno == EINTR && alarm_left) {
-      alarm(alarm_left);
+      if (cache->catch_deadlocks)
+        alarm(alarm_left);
       continue;
     }
 
     /* Lock failed? */
     _mmc_set_error(cache, errno, "Lock failed");
-    alarm(old_alarm);
+    if (cache->catch_deadlocks)
+      alarm(old_alarm);
     return -1;
   }
 

Modified: branches/upstream/libcache-fastmmap-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/Changes?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/Changes (original)
+++ branches/upstream/libcache-fastmmap-perl/current/Changes Sun Oct  3 19:11:24 2010
@@ -1,4 +1,10 @@
 Revision history for Perl extension Cache::FastMmap.
+
+1.36 Wed Sep 29 13:10 2010
+  - Disable wrapping fcntl() lock call in alarm, hurts
+     people that use Time::HiRes::alarm() only to try
+     and catch buggy deadlock code. Enable with
+     catch_deadlocks option
 
 1.35 Fri Feb 19 12:45 2010
   - Fix for returning potential bug that returns old stored

Modified: branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm (original)
+++ branches/upstream/libcache-fastmmap-perl/current/FastMmap.pm Sun Oct  3 19:11:24 2010
@@ -287,7 +287,7 @@
 use warnings;
 use bytes;
 
-our $VERSION = '1.35';
+our $VERSION = '1.36';
 
 # Track currently live caches so we can cleanup in END {}
 #  if we have empty_on_exit set
@@ -480,6 +480,13 @@
 not already exist. If the share_file specified does already
 exist, it defaults to 0.
 
+=item * B<catch_deadlocks>
+
+Sets an alarm(10) before each page is locked via fcntl(F_SETLKW) to catch
+any deadlock. This used to be the default behaviour, but it's not really
+needed in the default case and could clobber sub-second Time::HiRes
+alarms setup by other code. Defaults to 0.
+
 =back
 
 =cut
@@ -507,6 +514,7 @@
   my $init_file = $Args{init_file} ? 1 : 0;
   my $test_file = $Args{test_file} ? 1 : 0;
   my $enable_stats = $Args{enable_stats} ? 1 : 0;
+  my $catch_deadlocks = $Args{catch_deadlocks} ? 1 : 0;
 
   # Worth out unlink default if not specified
   if (!exists $Args{unlink_on_exit}) {
@@ -623,6 +631,7 @@
   $Cache->fc_set_param('expire_time', $expire_time);
   $Cache->fc_set_param('share_file', $share_file);
   $Cache->fc_set_param('start_slots', $start_slots);
+  $Cache->fc_set_param('catch_deadlocks', $catch_deadlocks);
   $Cache->fc_set_param('enable_stats', $enable_stats);
 
   # And initialise it
@@ -1252,6 +1261,27 @@
 
 =back
 
+=item * From 1.36
+
+=over 4
+
+=item *
+
+Before 1.36, an alarm(10) would be set before each attempt to lock
+a page. The only purpose of this was to detect deadlocks, which
+should only happen if the Cache::FastMmap code was buggy, or a
+callback function in get_and_set() made another call into
+Cache::FastMmap.
+
+However this added unnecessary extra system calls for every lookup,
+and for users using Time::HiRes, it could clobber any existing
+alarms that had been set with sub-second resolution.
+
+So this has now been made an optional feature via the catch_deadlocks
+option passed to new.
+
+=back
+
 =back
 
 =back

Modified: branches/upstream/libcache-fastmmap-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/META.yml?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/META.yml (original)
+++ branches/upstream/libcache-fastmmap-perl/current/META.yml Sun Oct  3 19:11:24 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                Cache-FastMmap
-version:             1.35
+version:             1.36
 abstract:            Uses an mmap'ed file to act as a shared memory interprocess cache
 license:             ~
 author:              

Modified: branches/upstream/libcache-fastmmap-perl/current/t/14.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/t/14.t?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/t/14.t (original)
+++ branches/upstream/libcache-fastmmap-perl/current/t/14.t Sun Oct  3 19:11:24 2010
@@ -27,16 +27,16 @@
 
 my ($nreads, $nreadhits) = $FC->get_statistics();
 
-ok( $nreads == 102 );
-ok( $nreadhits == 101 );
+cmp_ok( $nreads, '==', 102 );
+cmp_ok( $nreadhits, '==', 101 );
 
 ($nreads, $nreadhits) = $FC->get_statistics(1);
 
-ok( $nreads == 102 );
-ok( $nreadhits == 101 );
+cmp_ok( $nreads, '==', 102 );
+cmp_ok( $nreadhits, '==', 101 );
 
 ($nreads, $nreadhits) = $FC->get_statistics(1);
 
-ok( $nreads == 0 );
-ok( $nreadhits == 0 );
+cmp_ok( $nreads, '==', 0 );
+cmp_ok( $nreadhits, '==', 0 );
 

Modified: branches/upstream/libcache-fastmmap-perl/current/t/6.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcache-fastmmap-perl/current/t/6.t?rev=63240&op=diff
==============================================================================
--- branches/upstream/libcache-fastmmap-perl/current/t/6.t (original)
+++ branches/upstream/libcache-fastmmap-perl/current/t/6.t Sun Oct  3 19:11:24 2010
@@ -25,6 +25,8 @@
 our ($DidRead, $DidWrite, $DidDelete, $HitCount);
 
 our $FC;
+$FC = Cache::FastMmap->new(init_file => 0, raw_values => 1);
+$FC = undef;
 
 TestLeak(\&NewLeak);
 TestLeak(\&NewLeak);




More information about the Pkg-perl-cvs-commits mailing list