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

Doesn't cope with reply from "sentinel slaves sentinel1" #7

Open
rlipscombe opened this issue Jan 8, 2015 · 1 comment
Open

Doesn't cope with reply from "sentinel slaves sentinel1" #7

rlipscombe opened this issue Jan 8, 2015 · 1 comment

Comments

@rlipscombe
Copy link

Sent:

*3
$8
SENTINEL
$6
SLAVES
$18
sentinel_sentinel1

Got:

*2
*38
$4
name
$14
127.0.0.1:6377
$2
ip
$9
127.0.0.1
$4
port
$4
6377
$5
runid
$40
fdde50c3d85aec08d89d9ff30d7026e26d77ec4f
$5
flags
$5
slave
$16
pending-commands
$1
0
$14
last-ping-sent
$1
0
$18
last-ok-ping-reply
$3
708
$15
last-ping-reply
$3
708
$23
down-after-milliseconds
$5
30000
$12
info-refresh
$4
7895
$13
role-reported
$5
slave
$18
role-reported-time
$7
4063630
$21
master-link-down-time
$1
0
$18
master-link-status
$2
ok
$11
master-host
$9
127.0.0.1
$11
master-port
$4
6379
$14
slave-priority
$3
100
$17
slave-repl-offset
$6
286818
*38
$4
name
$14
127.0.0.1:6378
$2
ip
$9
127.0.0.1
$4
port
$4
6378
$5
runid
$40
2bed82918457d918ae4230adfbb622cb4edf2430
$5
flags
$5
slave
$16
pending-commands
$1
0
$14
last-ping-sent
$1
0
$18
last-ok-ping-reply
$3
708
$15
last-ping-reply
$3
708
$23
down-after-milliseconds
$5
30000
$12
info-refresh
$4
7895
$13
role-reported
$5
slave
$18
role-reported-time
$7
4063630
$21
master-link-down-time
$1
0
$18
master-link-status
$2
ok
$11
master-host
$9
127.0.0.1
$11
master-port
$4
6379
$14
slave-priority
$3
100
$17
slave-repl-offset
$6
286818

This was incorrectly parsed as:

21> rp(redo:cmd(C, ["SENTINEL", "SLAVES", <<"sentinel_sentinel1">>])).
[[<<"name">>,<<"127.0.0.1:6377">>,<<"ip">>,<<"127.0.0.1">>,
  <<"port">>,<<"6377">>,<<"runid">>,
  <<"fdde50c3d85aec08d89d9ff30d7026e26d77ec4f">>,<<"flags">>,
  <<"slave">>,<<"pending-commands">>,<<"0">>,
  <<"last-ping-sent">>,<<"0">>,<<"last-ok-ping-reply">>,
  <<"708">>,<<"last-ping-reply">>,<<"708">>,
  <<"down-after-milliseconds">>,<<"30000">>,
  <<"info-refresh">>,<<"7895">>,<<"role-reported">>,
  <<"slave">>,<<"role-reported-time">>,<<"4063630">>,
  <<"master-link-down-time">>,<<"0">>,
  <<"master-link-status">>,<<"ok">>,<<"master-host">>,
  <<"127.0.0.1">>,<<"master-port">>,<<"6379">>,
  <<"slave-priority">>,<<"100">>,<<"slave-repl-offset">>,
  <<"286818">>],
 [[<<"name">>,<<"127.0.0.1:6377">>,<<"ip">>,<<"127.0.0.1">>,
   <<"port">>,<<"6377">>,<<"runid">>,
   <<"fdde50c3d85aec08d89d9ff30d7026e26d77ec4f">>,<<"flags">>,
   <<"slave">>,<<"pending-commands">>,<<"0">>,
   <<"last-ping-sent">>,<<"0">>,<<"last-ok-ping-reply">>,
   <<"708">>,<<"last-ping-reply">>,<<"708">>,
   <<"down-after-milliseconds">>,<<"30000">>,
   <<"info-refresh">>,<<"7895">>,<<"role-reported">>,
   <<"slave">>,<<"role-reported-time">>,<<"4063630">>,
   <<"master-link-down-time">>,<<"0">>,
   <<"master-link-status">>,<<"ok">>,<<"master-host">>,
   <<"127.0.0.1">>,<<"master-port">>,<<"6379">>,
   <<"slave-priority">>,<<"100">>,<<"slave-repl-offset">>,
   <<"286818">>],
  <<"name">>,<<"127.0.0.1:6378">>,<<"ip">>,<<"127.0.0.1">>,
  <<"port">>,<<"6378">>,<<"runid">>,
  <<"2bed82918457d918ae4230adfbb622cb4edf2430">>,<<"flags">>,
  <<"slave">>,<<"pending-commands">>,<<"0">>,
  <<"last-ping-sent">>,<<"0">>,<<"last-ok-ping-reply">>,
  <<"708">>,<<"last-ping-reply">>,<<"708">>,
  <<"down-after-milliseconds">>,<<"30000">>,
  <<"info-refresh">>,<<"7895">>,<<"role-reported">>,
  <<"slave">>,<<"role-reported-time">>,<<"4063630">>,
  <<"master-link-down-time">>,<<"0">>,
  <<"master-link-status">>,<<"ok">>,<<"master-host">>,
  <<"127.0.0.1">>,<<"master-port">>,<<"6379">>,
  <<"slave-priority">>,<<"100">>,<<"slave-repl-offset">>,
  <<"286818">>]]
ok

Note that the first response is repeated in the head of the second response...

@rlipscombe
Copy link
Author

Cut down repro:

Expected = [[<<"foo">>],[<<"bar">>]].
Bytes = <<"*2\r\n*1\r\n$3\r\nfoo\r\n*1\r\n$3\r\nbar\r\n\n">>.
{ok, Actual, _} = redo_redis_proto:parse([], {raw, Bytes}).

% Nope!
Actual = Expected.

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

No branches or pull requests

1 participant