etcd-io / zetcd

Serve the Apache Zookeeper API but back it with an etcd cluster
Apache License 2.0
1.09k stars 94 forks source link

Use last Value for get instead of third Value #86

Closed tsuraan closed 7 years ago

tsuraan commented 7 years ago

Sometimes (such as when doing a get on /), the server's response won't have any Kvs in the second response. This causes zetcd to crash when a client does a get on /. I'm not certain this change is valid, but it does prevent the crash. It also gives some rather arbitrary looking data for the node's value, probably because it's using an arbitrary response instead of the hard-coded second response. Maybe we need to always use Responses[2], but if it has no Kvs, use an empty byte array instead of crashing?

If desired, I can make that change. I just don't want zetcd to crash quite so easily.

heyitsanthony commented 7 years ago

can this be reproduced with a test case?

tsuraan commented 7 years ago

I'm not sure how the zetcd unit tests work. Is it all in the integration directory? Anyhow, just connecting with a zookeeper client (zkCli would probably work, but I'm using the python kazoo library) and doing a get "/" currently crashes zetcd. It should be a pretty easy test, but I'm not sure where it should go.