etcd icon indicating copy to clipboard operation
etcd copied to clipboard

Serious error when adding node to a cluster with > 20,000 things in a directory

Open lvarvel opened this issue 12 years ago • 15 comments

This is a refinement of issue #588.

There is a serious problem with adding new nodes to a cluster with > 20,000 items in a directory.

Steps to reproduce:

  1. Fire up a three node cluster
  2. Place 20,000-ish entries under /v2/keys/test
  3. Add a new node to the cluster
  4. Observe explosions.

After adding the new node, we start getting the following log messages from the leader: "transporter.ss.decoding.error:proto: field/encoding mismatch: wrong type for field"

Also, the following log messages show up on the new node: "[ss] Error: nil response"

You can also get the same result by downing an existing node, deleting its data directory, and bringing it back up.

Perhaps a protocol buffer problem?

lvarvel avatar Feb 22 '14 01:02 lvarvel

@lvarvel So the problem of #588 is not caused by upgrade?

xiang90 avatar Feb 22 '14 01:02 xiang90

It would seem so - we think the way we upgrade (nuking the data directory) is leading us down this path.

On Friday, February 21, 2014, Xiang Li [email protected] wrote:

@lvarvel https://github.com/lvarvel So the problem of #588https://github.com/coreos/etcd/issues/588is not caused by upgrade?

Reply to this email directly or view it on GitHubhttps://github.com/coreos/etcd/issues/591#issuecomment-35791275 .

onsi avatar Feb 22 '14 01:02 onsi

Onsi's correct. #588 should probably be closed, since everything in it can be explained by this issue (#591).

It turns out that upgrading has nothing to do with this, since we can reproduce the problem on a new cluster of 0.3.0 nodes.

Also, the 20,000 item count isn't a firm number. It's just sufficiently large to make things stop working.

If you need more details, let us know. On Feb 21, 2014 5:52 PM, "Onsi Fakhouri" [email protected] wrote:

It would seem so - we think the way we upgrade (nuking the data directory) is leading us down this path.

On Friday, February 21, 2014, Xiang Li [email protected] wrote:

@lvarvel https://github.com/lvarvel So the problem of #588< https://github.com/coreos/etcd/issues/588>is not caused by upgrade?

Reply to this email directly or view it on GitHub< https://github.com/coreos/etcd/issues/591#issuecomment-35791275> .

Reply to this email directly or view it on GitHubhttps://github.com/coreos/etcd/issues/591#issuecomment-35791328 .

lvarvel avatar Feb 22 '14 07:02 lvarvel

@onsi @lvarvel It has something to do with sending snapshot. I will check it.

xiang90 avatar Feb 22 '14 15:02 xiang90

sweet -- thanks xiang!

On Sat, Feb 22, 2014 at 7:03 AM, Xiang Li [email protected] wrote:

@onsi https://github.com/onsi @lvarvel https://github.com/lvarvel It has something to do with sending snapshot. I will check it.

Reply to this email directly or view it on GitHubhttps://github.com/coreos/etcd/issues/591#issuecomment-35804598 .

onsi avatar Feb 22 '14 21:02 onsi

@lvarvel @onsi I am not able to reproduce this on current master.

Here is my testing step:

  1. ./etcd -peer-addr 127.0.0.1:7001 -addr 127.0.0.1:4001 -data-dir machines/machine1 -name machine1 -f -vv
  2. ./etcd -peer-addr 127.0.0.1:7002 -addr 127.0.0.1:4002 -peers 127.0.0.1:7001,127.0.0.1:7003 -data-dir machines/machine2 -name machine2 -vv -f
  3. ./etcd -peer-addr 127.0.0.1:7003 -addr 127.0.0.1:4003 -peers 127.0.0.1:7001,127.0.0.1:7002 -data-dir machines/machine3 -name machine3 -f -vv
  4. set 25000 keys into directory /tests/ and wait for a snapshot
  5. ./etcd -peer-addr 127.0.0.1:7004 -addr 127.0.0.1:4004 -peers 127.0.0.1:7001,127.0.0.1:7002 -data-dir machines/machine4 -name machine4 -vv -f
  6. The new node successfully received the snapshot request and the snapshot. It then recovered from the received snapshot.
[etcd] Feb 22 23:20:46.142 DEBUG     | open machines/machine4/snapshot: no such file or directory
[raft]23:20:46.142326 log.open.open  machines/machine4/log
[raft]23:20:46.142450 log.open.create  machines/machine4/log
[etcd] Feb 22 23:20:46.142 INFO      | machine4: state changed from 'stopped' to 'follower'.
[raft]23:20:46.142528 Name: machine4, State: follower, Term: 0, CommitedIndex: 0
[etcd] Feb 22 23:20:46.143 DEBUG     | Send Join Request to http://127.0.0.1:7001/join
[etcd] Feb 22 23:20:46.144 DEBUG     | Send Join Request to http://127.0.0.1:7002/join
[etcd] Feb 22 23:20:46.174 DEBUG     | machine4 joined the cluster via peer 127.0.0.1:7001
[etcd] Feb 22 23:20:46.174 INFO      | etcd server [name machine4, listen on [::]:4004, advertised url http://127.0.0.1:4004]
[etcd] Feb 22 23:20:46.175 INFO      | peer server [name machine4, listen on [::]:7004, advertised url http://127.0.0.1:7004]
[etcd] Feb 22 23:20:46.225 DEBUG     | [recv] POST http://127.0.0.1:7004/snapshot
[etcd] Feb 22 23:20:46.225 INFO      | machine4: state changed from 'follower' to 'snapshotting'.
[etcd] Feb 22 23:20:46.231 DEBUG     | [recv] POST http://127.0.0.1:7004/snapshotRecovery
[etcd] Feb 22 23:20:46.263 INFO      | machine4: peer added: 'machine1'
[etcd] Feb 22 23:20:46.263 INFO      | machine4: peer added: 'machine3'
[etcd] Feb 22 23:20:46.263 INFO      | machine4: peer added: 'machine2'
[raft]23:20:46.264181 update.commit.index  20367
[etcd] Feb 22 23:20:46.277 DEBUG     | [recv] POST http://127.0.0.1:7004/log/append [291]
[etcd] Feb 22 23:20:46.277 INFO      | machine4: state changed from 'snapshotting' to 'follower'.
[etcd] Feb 22 23:20:46.277 INFO      | machine4: leader changed from '' to 'machine2'.

Are all nodes in your testing 0.3? Or some of them are 0.2? Looking at your log, the new node cannot decode the snapshot request. Actually we have upgraded the protobuf library recently without changing the structure layout. Might be the bytes generated by two version of protobuf are not compatible?

xiang90 avatar Feb 23 '14 04:02 xiang90

@lvarvel @onsi I will test the compatibility of the two different go-protobuf implementation. Then I will have more knowledge about this problem. Thanks!

xiang90 avatar Feb 23 '14 04:02 xiang90

Thank you!

We believe all the nodes were 0.3.0, but we can double-check on Monday. We can also provide you with our compiled binaries, if that's helpful. On Feb 22, 2014 8:29 PM, "Xiang Li" [email protected] wrote:

@lvarvel https://github.com/lvarvel @onsi https://github.com/onsi I will test the compatibility of the two different go-protobuf implementation. Then I will have more knowledge about this problem. Thanks!

Reply to this email directly or view it on GitHubhttps://github.com/coreos/etcd/issues/591#issuecomment-35823697 .

lvarvel avatar Feb 23 '14 04:02 lvarvel

yes, would be great to confirm if @xiangli-cmu's steps recreate with your binaries.

polvi avatar Feb 23 '14 07:02 polvi

I was able to reproduce the problem on my macbook (10.9.1), etcd f9d27c37.

When I used the key "/v2/keys/test/keyN" and the value "messageN" (N: 1..25000), the snapshot worked

When I used the key "/v2/keys/messageN" and the value "Hello world N", the snapshot failed

Perhaps the space in the value is significant.

I'll investigate further on Monday and post more details on the repro case

(I was working with @lvarvel and @onsi on this last week)

dliebreich avatar Feb 24 '14 05:02 dliebreich

@dliebreich OK. This is interesting... I will try to reproduce it.

xiang90 avatar Feb 24 '14 06:02 xiang90

@fraenkel and I have only been able to reproduce this intermittently.

One thing we did manage to do was to insert some println debug output into the node that joins and emits the "[ss] Error: nil response" message.

We noticed that the snapshotLoop (in raft/server.go) is receiving a SnapshotRequest event target. That loop does not handle that case, unlike the followerLoop.

Please let us know if there is anything in particular you would like us to do next.

dliebreich avatar Feb 25 '14 19:02 dliebreich

@lvarvel @dliebreich Sorry for the delay. I can reproduce it now. I am trying to solve it :). Thanks.

xiang90 avatar Mar 08 '14 03:03 xiang90

@lvarvel @dliebreich @onsi https://github.com/coreos/etcd/pull/616

I am also working on the raft problem. But #616 should fix this issue.

xiang90 avatar Mar 08 '14 05:03 xiang90

Great! Thank you. On Mar 7, 2014 9:24 PM, "Xiang Li" [email protected] wrote:

@lvarvel https://github.com/lvarvel @dliebreichhttps://github.com/dliebreich @onsi https://github.com/onsi #616 https://github.com/coreos/etcd/pull/616

I am also working on the raft problem. But #616https://github.com/coreos/etcd/pull/616should fix this issue.

Reply to this email directly or view it on GitHubhttps://github.com/coreos/etcd/issues/591#issuecomment-37089734 .

lvarvel avatar Mar 08 '14 07:03 lvarvel