phaistos-networks / TANK

A very high performance distributed log service
Apache License 2.0
938 stars 70 forks source link

tank-cli crash if message has key but no length #39

Closed rkrambovitis closed 8 years ago

rkrambovitis commented 8 years ago

Steps:

  1. ./tank-cli -b localhost:11011 -p 0 -t foo set -K hello foo
#0  Buffer::Reserved (this=<optimized out>) at Switch/buffer.h:173
#1  TankClient::get_buffer (this=0x7ffcac33b8a0) at tank_client.h:474
#2  TankClient::try_recv (this=this@entry=0x7ffcac33b8a0, c=c@entry=0x799830) at client.cpp:2010
#3  0x0000000000418f5b in TankClient::poll (this=0x7ffcac33b8a0, timeoutMS=<optimized out>, timeoutMS@entry=800) at client.cpp:2453
#4  0x00000000004039af in <lambda()>::operator()(void) const (__closure=0x7ffcac33b730) at cli.cpp:949
#5  0x0000000000406cbd in main (argc=2, argv=<optimized out>) at cli.cpp:1201
  1. (after setting blanks in step 1) ./tank-cli -b localhost:11011 -p 0 -t foo get 0
#0  TankClient::get_payload (this=this@entry=0x7ffc61b47630) at tank_client.h:501
#1  0x000000000041ebbb in TankClient::consume_from_leader (this=this@entry=0x7ffc61b47630, clientReqId=clientReqId@entry=2, leader=..., 
    leader@entry=..., from=from@entry=0x12c3a70, total=total@entry=1, maxWait=maxWait@entry=8000, minSize=0) at client.cpp:914
#2  0x0000000000422007 in TankClient::consume (this=this@entry=0x7ffc61b47630, req=std::vector of length 1, capacity 1 = {...}, 
    maxWait=maxWait@entry=8000, minSize=minSize@entry=0) at client.cpp:2698
#3  0x0000000000407227 in main (argc=<optimized out>, argv=<optimized out>) at cli.cpp:348
markpapadakis commented 8 years ago

For set -K you need to use key=value notation. It shouldn't have crashed though. set -K foo=bar key=val

rkrambovitis commented 8 years ago

it seems to crash even with message

./tank-cli -b localhost:11011 -p 0 -t foo set -K hello=foo Segmentation fault (core dumped)

#0  Buffer::Reserved (this=<optimized out>) at Switch/buffer.h:173
#1  TankClient::get_buffer (this=0x7ffc785e53e0) at tank_client.h:474
#2  TankClient::try_recv (this=this@entry=0x7ffc785e53e0, c=c@entry=0xed1830) at client.cpp:2010
#3  0x0000000000418f5b in TankClient::poll (this=0x7ffc785e53e0, timeoutMS=<optimized out>, timeoutMS@entry=800) at client.cpp:2453
#4  0x00000000004039af in <lambda()>::operator()(void) const (__closure=0x7ffc785e5270) at cli.cpp:949
#5  0x0000000000406cbd in main (argc=1, argv=<optimized out>) at cli.cpp:1201
markpapadakis commented 8 years ago

Likely fixed - thanks for reporting it. This was an edge case where we 'd collapse bundles from multiple segments into the same segment due to min file.size constraints.