korlibs-archive / korio

Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3

Home Page:https://korlibs.soywiz.com/korio/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HttpClient request suspends forever on linuxX64 platform

Chazoshtare opened this issue · comments

I created a simple project that uses HttpClient to perform a single GET request, as follows:

val client = createHttpClient()
val response = client.request(
    Http.Method.GET,
    "https://raw.githubusercontent.com/korlibs/korio/master/README.md"
).readAllString()

println(response)

For linuxX64, it suspends forever on client.request() call, never finishing the actual request.

It seems to be a platform specific problem, as it works on mingwX64 as intended. I tested it on two different Debian and Arch Linux machines, so it's unlikely to be dependent on a specific distro.

Sample project: koriotest.zip

Can confirm. relevant strace output:

sendto(3, "GET /"..., 368, 0, NULL, 0) = 368
ioctl(3, FIONREAD, [0])                 = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=0}, NULL) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=9877533}, NULL) = 0
ioctl(3, FIONREAD, [0])                 = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=0}, NULL) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=9887431}, NULL) = 0
ioctl(3, FIONREAD, [0])

(keeps repeating infinitely)

This was fixed already on master (missed SSL on linux and probably it tried to use a plain socket instead)

korlibs-archive/korge-next@b32d449