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

Already on GitHub? Sign in to your account

wrong values are passed to callback when transaction fails #355

Closed
maenwen opened this Issue Dec 24, 2012 · 2 comments

Comments

Projects
None yet
4 participants

maenwen commented Dec 24, 2012

CODE:

var redis = require("redis"),
    client = redis.createClient();

redis.debug_mode = true;


client.watch('test1', function(err, reply) {

  client.set('test1', '1');

  client.multi()
    .set('test2', '2')
    .set('test3', '3')
    .exec(function (err, replies) {
      console.log(err);
      console.log(replies);
      console.log("EXEC callback");

      if (!replies) return;

      console.log("MULTI got " + replies.length + " replies");
      replies.forEach(function (reply, index) {
        console.log("Reply " + index + ": " + reply.toString());
      });
    });

  client.keys('*', function(err, replies) {
    console.log(err);
    console.log(replies);
    console.log("keys callback");

    if (!replies) return;

    console.log("keys got " + replies.length + " replies");
    replies.forEach(function (reply, index) {
      console.log("Reply " + index + ": " + reply.toString());
    });
  });
});

OUTPUT:

evgeny@dev /home/nodejs/vevent/lib$ node test.js
Queueing watch for next server connection.
Stream connected 127.0.0.1:6379 id 1
Using default parser module: javascript
checking server ready state...
send 127.0.0.1:6379 id 1: *1
$4
info

send_command buffered_writes: 0  should_buffer: true
net read 127.0.0.1:6379 id 1: $1495
# Server
redis_version:2.6.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_mode:standalone
os:Linux 2.6.18-308.13.1.el5PAE i686
arch_bits:32
multiplexing_api:epoll
gcc_version:4.1.2
process_id:9098
run_id:b498fd917a04acf151e44542d5420d69f0565b46
tcp_port:6379
uptime_in_seconds:537786
uptime_in_days:6
lru_clock:1415711

# Clients
connected_clients:3
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:705560
used_memory_human:689.02K
used_memory_rss:1822720
used_memory_peak:7896448
used_memory_peak_human:7.53M
used_memory_lua:20480
mem_fragmentation_ratio:2.58
mem_allocator:jemalloc-3.2.0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1356329320
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok

# Stats
total_connections_received:445
total_commands_processed:3809158
instantaneous_ops_per_sec:0
rejected_connections:0
expired_keys:0
evicted_keys:0
keyspace_hits:133753
keyspace_misses:18383
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:477

# Replication
role:master
connected_slaves:0

# CPU
used_cpu_sys:85.19
used_cpu_user:111.04
used_cpu_sys_children:0.47
used_cpu_user_children:0.12

# Keyspace
db0:keys=3,expires=0


Redis server ready.
Sending offline command: watch
send 127.0.0.1:6379 id 1: *2
$5
watch
$5
test1

send_command buffered_writes: 0  should_buffer: false
net read 127.0.0.1:6379 id 1: +OK

send 127.0.0.1:6379 id 1: *3
$3
set
$5
test1
$1
1

send_command buffered_writes: 0  should_buffer: false
send 127.0.0.1:6379 id 1: *1
$5
MULTI

send_command buffered_writes: 0  should_buffer: false
send 127.0.0.1:6379 id 1: *3
$3
set
$5
test2
$1
2

send_command buffered_writes: 0  should_buffer: false
send 127.0.0.1:6379 id 1: *3
$3
set
$5
test3
$1
3

send_command buffered_writes: 0  should_buffer: false
send 127.0.0.1:6379 id 1: *1
$4
EXEC

send_command buffered_writes: 0  should_buffer: false
send 127.0.0.1:6379 id 1: *2
$4
keys
$1
*

send_command buffered_writes: 0  should_buffer: false
net read 127.0.0.1:6379 id 1: +OK
+OK
+QUEUED
+QUEUED
*-1
*3
$5
test2
$5
test1
$5
test3

no callback for reply: OK
null
null
EXEC callback
null
test2
keys callback
keys got 5 replies

/home/nodejs/vevent/lib/node_modules/redis/index.js:523
            throw err;
                  ^
TypeError: Object test2 has no method 'forEach'
    at /home/nodejs/vevent/lib/test.js:35:13
    at try_callback (/home/nodejs/vevent/lib/node_modules/redis/index.js:520:9)
    at RedisClient.return_reply (/home/nodejs/vevent/lib/node_modules/redis/index.js:590:13)
    at ReplyParser.RedisClient.init_parser (/home/nodejs/vevent/lib/node_modules/redis/index.js:263:14)
    at ReplyParser.EventEmitter.emit (events.js:93:17)
    at ReplyParser.send_reply (/home/nodejs/vevent/lib/node_modules/redis/lib/parser/javascript.js:297:10)
    at ReplyParser.execute (/home/nodejs/vevent/lib/node_modules/redis/lib/parser/javascript.js:198:22)
    at RedisClient.on_data (/home/nodejs/vevent/lib/node_modules/redis/index.js:476:27)
    at Socket. (/home/nodejs/vevent/lib/node_modules/redis/index.js:79:14)
    at Socket.EventEmitter.emit (events.js:93:17)

Contributor

DTrejo commented Feb 18, 2013

Seems like a duplicate of #187, please throw in on that issue if you get error again once it is merged (looking to merge soon, hopefully within the month)

@DTrejo DTrejo closed this Feb 18, 2013

Owner

brycebaril commented Feb 18, 2013

Actually this is a dupe of #348 which I have a fix for and will be submitting a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment