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

Nodes do not attempt reconnecting after initial connection refused #32

Open
freyacodes opened this issue Oct 16, 2023 · 2 comments
Open

Comments

@freyacodes
Copy link
Contributor

After calling Lavakord.addNode() and encountering a refused connection, this exception is raised:

Exception in thread "DefaultDispatcher-worker-9" java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:673)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)
	at io.ktor.network.sockets.SocketImpl.connect$ktor_network(SocketImpl.kt:50)
	at io.ktor.network.sockets.SocketImpl$connect$1.invokeSuspend(SocketImpl.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)

The coroutine then ends without retrying, as retries are only done when ReconnectException is caught.

java.net.ConnectException is JVM specific, so I am unsure how to catch it in multiplatform code

@DRSchlaubi
Copy link
Member

DRSchlaubi commented Oct 16, 2023

} catch (e: ConnectException) {
internalReconnect(e)
}

That should be cought

@freyacodes
Copy link
Contributor Author

freyacodes commented Oct 17, 2023

Upon closer inspection, the problem is caused by the exception being thrown by check(), which has no fault tolerance.

I'm very tempted to just wrap a try/catch around check() for Exception

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

2 participants