Camelcade / Devel-Camelcadedb

Perl module for debugging with Perl5 plugin for IntelliJ
Other
23 stars 9 forks source link

Running under Camelcade debugger changes behavior of Cache::FastMmap #22

Closed gbegen closed 8 years ago

gbegen commented 8 years ago

When running our web server in the Camelcade debugger, it is unable to properly manage sessions. Session management in this configuration uses CHI and Cache::FastMmap.

I have reduced it to the following two scripts:

put-in-cache.pl

use 5.14.0;
use strictures 1;

use CHI;

my $cache = CHI->new(
  driver         => 'FastMmap',
  cache_size     => '10m',
  unlink_on_exit => 0,
  root_dir       => "/tmp/test-cache-$>",
);

$cache->set('abc', 'def', 1209600);

get-from-cache.pl

use 5.14.0;
use strictures 1;

use CHI;

my $cache = CHI->new(
  driver         => 'FastMmap',
  cache_size     => '10m',
  unlink_on_exit => 0,
  root_dir       => "/tmp/test-cache-$>",
);

my $value = $cache->get('abc');

die 'Failed to read value from cache' unless $value;
say "value: $value";

If you run put-in-cache.pl once, it will create a persistent cache with the value in it. Then running get-from-cache.pl should be able to pull it back out and print it. This works fine when run outside of the debugger and when run within the standard perl -d debugger.

When run from within the Camelcade debugger, however, the value fails to be retrieved. Furthermore, in trying to debug the reason, it turns out to be a Heisenbug that I can't track down. Placing breakpoints within Cache/FastMmap.pm or adding print statements there can make the problem disappear.

I can't see anything in particular within the Camelcade debugger that should cause this. I wonder if it has anything to do with the XS nature of Cache::FastMmap.

Local Environment: Mac OSX El Capitan running Perl5 plugin 2.101 in Android Studio Remote Environment: Ubuntu 12.04.5 running Perl 5.14.2 with CHI version 0.60, Cache::FastMmap version 1.44, Devel::Camelcadedb version 1.6.1.5.

hurricup commented 8 years ago

First: your bug-reports are awesome! Thank you. Second - I'll check it.

hurricup commented 8 years ago

Please, try cpan HURRICUP/Devel-Camelcadedb-1.6.1.6.tar.gz should work fine now. Let me know if it helps.

gbegen commented 8 years ago

This does indeed fix my problem. Thank you.