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

Gnet hangs on receive incomplete request #297

Open
slow-zhang opened this issue Dec 10, 2021 · 9 comments
Open

Gnet hangs on receive incomplete request #297

slow-zhang opened this issue Dec 10, 2021 · 9 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested waiting for response waiting for the response from commenter

Comments

@slow-zhang
Copy link

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/redis@3.2/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/redis@3.2/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?

@slow-zhang slow-zhang added help wanted Extra attention is needed question Further information is requested labels Dec 10, 2021
@panjf2000
Copy link
Owner

panjf2000 commented Dec 13, 2021

Use dlv to debug your server and find out why.

@slow-zhang
Copy link
Author

i have using dlv and find the reason just like the title: Gnet hangs on receive incomplete request

@panjf2000
Copy link
Owner

Share more details with me?

@slow-zhang
Copy link
Author

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/redis@3.2/bin/redis-benchmark -t set,get -n 10 -d 100000 -r 100000 -c 1 -p <port>
image

@wathenjiang
Copy link
Contributor

@slow-zhang @panjf2000
if len(buf) == 0 is true, we should return nil,gerrors.ErrIncompletePacketinstead 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.

@panjf2000 panjf2000 added the waiting for response waiting for the response from commenter label Dec 23, 2021
@slow-zhang
Copy link
Author

thanks for helping! i will fix it later

@slow-zhang
Copy link
Author

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

image

@panjf2000
Copy link
Owner

Please upgrade to gnet v1.6.4 and try again.

@slow-zhang
Copy link
Author

so can i assume that there is a bug fix for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested waiting for response waiting for the response from commenter
Projects
None yet
Development

No branches or pull requests

3 participants