Skip to content

use of closed network connection socket error read tcp XXXXXXX: use of closed network connection #708

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

Open
druphliu opened this issue Apr 30, 2025 · 8 comments
Assignees

Comments

@druphliu
Copy link

druphliu commented Apr 30, 2025

When subscribing to k-line data using the method futures.WsContinuousKlineServe, this error often occurs, causing the WebSocket (ws) connection to be interrupted. I have tried to ensure reconnection through the following methods,

for { doneC, _, err := futures.WsContinuousKlineServe(&futures.WsContinuousKlineSubscribeArgs{ Pair: symbol, ContractType: "PERPETUAL", Interval: interval, }, wsKlineHandler, errHandler) if err != nil { continue } <-doneC time.Sleep(time.Second * 10) }

but there is a problem. That is, the pushed data is lost during the reconnection process. How can this be solved?

@sc0Vu sc0Vu self-assigned this Apr 30, 2025
@sc0Vu
Copy link
Contributor

sc0Vu commented Apr 30, 2025

@druphliu Have you checked your network connection? The TCP error likely indicates a disconnection from the server.

@druphliu
Copy link
Author

@druphliu Have you checked your network connection? The TCP error likely indicates a disconnection from the server.

yes,It is a server network and relatively stable

@minxtiny
Copy link

minxtiny commented May 2, 2025

I also encountered this issue too, and switching to version 2.8.1 resolved it.

@batouy
Copy link

batouy commented May 13, 2025

I also encountered this issue too, and switching to version 2.8.1 resolved it.

seems you are right

@sc0Vu
Copy link
Contributor

sc0Vu commented May 13, 2025

What do you mean pushed data is lost during the reconnection? How can I reproduce this locally? The error means the software read from the closed TCP connection, it happened if the network is disconnected.

@druphliu
Copy link
Author

The network has always been relatively stable, and this issue can steadily emerge. During the reconnection process, it is inevitable that the pushed data will not be received

@sc0Vu
Copy link
Contributor

sc0Vu commented May 19, 2025

@druphliu Which environment did you use, testnet or mainnet? I wonder why change to 2.8.1 solved the issue? If the connection was unstable and reconnected, I think the data would be missed in that period and exchange api may push data later (because the writing on their side would be unstable).

@druphliu
Copy link
Author

mainnet,I use the 2.8.2,this err always happen on the 2.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants