-
Notifications
You must be signed in to change notification settings - Fork 1k
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
secure Websocket client failed #560
Comments
Any work around until fixed? |
The fix is complete and would be available in |
still not work, you cant test it by code in first post |
Could you provide the details?
|
as i see sometimes it works for 1st try, but then no success, i test it on Ubuntu 18.04, jvm 8/11 using this test https://github.com/coolemza/WSTest |
The problem of hanging is in for (message in incoming.map { it as? Frame.Text }.filterNotNull())
Also, you could send a close frame after |
ok, ill check, but why it works in non secure case? |
tested with suspend fun main() = try {
println("start")
val client = HttpClient(CIO).config { install(WebSockets) }
client.wss(host = "echo.websocket.org") {
repeat(10) { send(Frame.Text("Hello World $it")) }
GlobalScope.launch(Dispatchers.IO) {
repeat(10) {
println((incoming.receive() as Frame.Text).readText())
}
}.join()
}
println("start finished")
} catch (e: Exception) {
e.printStackTrace()
println("stopped abnormal")
} same results, ws() works fine and wss() freezes without any message received, and when started testing first 2 times wss() receives messages, then stopped, seems like it depends on some kind of caching or timeouts issue |
It shouldn't work without close with the |
slightly modified test suspend fun main() = try {
println("start")
repeat(10) { cnt ->
println("try #$cnt")
val client = HttpClient( CIO).config { install(WebSockets) }
client.wss(host = "echo.websocket.org") {
repeat(10) { send(Frame.Text("Hello World $it")) }
GlobalScope.launch(Dispatchers.IO) {
repeat(10) {
println((incoming.receive() as Frame.Text).readText())
}
}.join()
}
client.close()
}
println("start finished")
} catch (e: Exception) {
e.printStackTrace()
println("stopped abnormal")
} and tested it in various ubuntu environments, same result it works for 1-3 iteration then freezes, you can reproduce it with git clone https://github.com/coolemza/WSTest.git
./gradlew build
java -jar build/libs/WSTest.jar |
Could you try to call |
tried suspend fun main() = try {
println("start")
repeat(10) { cnt ->
println("try #$cnt")
val client = HttpClient( CIO).config { install(WebSockets) }
client.wss(host = "echo.websocket.org") {
repeat(10) { send(Frame.Text("Hello World $it")) }
GlobalScope.launch(Dispatchers.IO) {
repeat(10) {
println((incoming.receive() as Frame.Text).readText())
}
}.join()
close(CloseReason(1000, "stop"))
}
}
println("start finished")
} catch (e: Exception) {
e.printStackTrace()
println("stopped abnormal")
} first run
second run freezes
|
The exception related to double Generally, it looks like we try to reuse the connection in case of an exception. Trying to reproduce it without WebSockets. Great thanks for the investigation. |
Could you reproduce it with |
1.1.4 still freezes |
We fix |
Closed. Please reopen if the problem is active. |
this code works:
this one freezes on connection:
The text was updated successfully, but these errors were encountered: