gnet
gnet copied to clipboard
Gnet hangs on receive incomplete request
What is your question about gnet?
i implement a redis server using gnet, but it can only pass the benchmark when one client send one request (-c 1, -n 1)
this is /usr/local/opt/[email protected]/bin/redis-benchmark -t set,get -n 1 -d 100000 -r 100000 -c 1 -p <port>
when set multi request (-c 1, -n 10)
this is /usr/local/opt/[email protected]/bin/redis-benchmark -t set,get -n 10 -d 100000 -r 100000 -c 1 -p <port>
here is my impl https://github.com/slow-zhang/gnet-test, am I use gnet by the error way?
Use dlv
to debug your server and find out why.
i have using dlv and find the reason just like the title: Gnet hangs on receive incomplete request
Share more details with me?
the redis-bench is hung and for the example the buf is always nil.
you can try the cmd by you self: /usr/local/opt/[email protected]/bin/redis-benchmark -t set,get -n 10 -d 100000 -r 100000 -c 1 -p <port>
@slow-zhang @panjf2000
if len(buf) == 0
is true, we should return nil,gerrors.ErrIncompletePacket
instead of just return
.
Please see this example of using client in gnet: https://github.com/Spongecaptain/gnet-examples/blob/master/examples/custom_codec/protocol/pb.go#L95, it may help.
thanks for helping! i will fix it later
after I fixed this error , the code can not even pass the benchmark when one client send one request (-c 1, -n 1)
here is the code after fixed: https://github.com/slow-zhang/gnet-test/blob/main/main.go#L142
Please upgrade to gnet v1.6.4 and try again.
so can i assume that there is a bug fix for it?