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

[Bug][SDK] Potential block in Golang SDK #10670

Closed
2 tasks done
gunli opened this issue Jul 18, 2024 · 0 comments · Fixed by #10674
Closed
2 tasks done

[Bug][SDK] Potential block in Golang SDK #10670

gunli opened this issue Jul 18, 2024 · 0 comments · Fixed by #10674
Assignees
Labels
component/sdk type/bug Something is wrong
Milestone

Comments

@gunli
Copy link
Contributor

gunli commented Jul 18, 2024

What happened

Let's review the code:
In the callback of conn.AsyncWrite() we may call worker.updateConn(), updateConn() may try to open new conn in some case, if so, it will call gnet.Client.Dial(), but gnet.Client.Dial() will be blocked unitl gnet event loop mark the conn is opened, but now the event loop is running in conn.AsyncWrite()'s callback:
conn.AsyncWrite()'s callback-->worker.updateConn()-->gnet.Client.Dial()-->waiting for conn.AsyncWrite()'s callback to return.

What you expected to happen

Do not block the SDK even if we update the conn in conn.AsyncWrite()'s callback.

How to reproduce

  1. Use the Golang SDK connect to a cluster data proxy and report messages;
  2. Stop or kill one of the data proxy;
  3. Some SDK may block when they attend to open new connections.

Or, review the code.
In the callback of conn.AsyncWrite() we may call worker.updateConn(), updateConn() may try to open new conn in some case, if so, it will call gnet.Client.Dial(), but gnet.Client.Dial() will be blocked unitl gnet event loop mark the conn is opened, but now the event loop is running in conn.AsyncWrite()'s callback:
conn.AsyncWrite()'s callback-->worker.updateConn()-->gnet.Client.Dial()-->waiting for conn.AsyncWrite()'s callback to return.

Environment

No response

InLong version

master

InLong Component

InLong SDK

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/sdk type/bug Something is wrong
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants