Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"reconnect disabled inside transaction" is not working sometimes #22

Closed
vsespb opened this issue Oct 8, 2014 · 0 comments · Fixed by #25
Closed

"reconnect disabled inside transaction" is not working sometimes #22

vsespb opened this issue Oct 8, 2014 · 0 comments · Fixed by #25

Comments

@vsespb
Copy link
Contributor

vsespb commented Oct 8, 2014

use strict;
use warnings;
use Redis::Fast;
my $conn = Redis::Fast->new(
    reconnect     => 20,
    every         => 1000,
);
while(1){
  eval {
    $conn->multi;
    $conn->set("x" => 42);
    $conn->exec;
  1;
  } or do {
    print $@;
  }
}

If I restart Redis server during this script, it should print reconnect disabled inside transaction or watch time to time.

But, it also prints ERR EXEC without MULTI sometimes

reconnect disabled inside transaction or watch at /usr/local/lib/perl/5.14.2/Redis/Fast.pm line 178.
[exec] ERR EXEC without MULTI,  at /usr/local/lib/perl/5.14.2/Redis/Fast.pm line 179.
    Redis::Fast::__ANON__(Redis::Fast=SCALAR(0x2406670)) called at d.pl line 12
    eval {...} called at d.pl line 14

I think that could happen if you copypasted that logic: https://metacpan.org/source/DAMS/Redis-1.976/lib/Redis.pm#L227

first $self->{__inside_transaction} is disabled, and then command is processed. this is a bug.

(same for UNWATCH)

shogo82148 added a commit that referenced this issue Oct 16, 2014
Changelog diff is:

diff --git a/Changes b/Changes
index e112e73..c065ba8 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Redis

 {{$NEXT}}
+
+0.13 2014-10-16T11:07:31Z
     - support password option
     - fix deep recursion when maxclients is reached and reconnect, name, on_connect parameters used #21
     - fix reconnect disabled inside transaction #22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant