K
Kord2mo ago
vyfor

[Kotlin/Native] Slow connection issues

i'm experiencing noticeable connection issues with Kord (branch feature/native on Linux). about 90% of interactions fail, i can't even defer them to respond later. so far i couldn't upload files too, and it takes 10 seconds for a message to be sent (and retrieved afterwards). what's strange is that it always takes 10 seconds. here's the code for the last part:
val (message, restLatency) = measureTimedValue {
ctx.message.reply("Calculating...") // this is sent instantly though
}

message.edit {
content = buildString {
append("Gateway: ")
appendLine(ctx.kord.gateway.averagePing ?: "unavailable")
append("REST: ")
append(restLatency)
}
}
val (message, restLatency) = measureTimedValue {
ctx.message.reply("Calculating...") // this is sent instantly though
}

message.edit {
content = buildString {
append("Gateway: ")
appendLine(ctx.kord.gateway.averagePing ?: "unavailable")
append("REST: ")
append(restLatency)
}
}
no such issues occur when i run on JVM. could this be related to Ktor, or maybe the curl engine itself?
No description
20 Replies
vyfor
vyfor2mo ago
Kord won't let me use the CIO engine either: TLS sessions are not supported on Native platform.
viztea
viztea2mo ago
well its a ktor thing not kord send trace logs
vyfor
vyfor2mo ago
though the first 2-3 requests were fine
No description
vyfor
vyfor2mo ago
i dont even know whats going on anymore
No description
viztea
viztea2mo ago
you can try manually instrumenting the http client to rule out rate limiter problems but it’s most likely a curl problem
vyfor
vyfor2mo ago
how would i do that?
viztea
viztea2mo ago
custom plugin or i think Http call logging is an official one
viztea
viztea2mo ago
is mine would need to remove the engine name thingy
vyfor
vyfor2mo ago
did i just need to install it as a plugin? if so, here are the logs:
[] [DISCOVERED]:[BUCKET]:Bucket discovered for 3df15bae86f6647dd4dfcbd5c6949480
TRACE: [] [Http/Ktor: Curl] <- POST https://discord.com/api/v10/channels/1191449585458094180/messages 200 OK - 10.772144703s
DEBUG: [[R]:[KTOR]:[ExclusionRequestRateLimiter]] [RESPONSE]:200:POST:https://discord.com/api/v10/channels/1191449585458094180/messages body:{"content":"Calculating...", ...}
DEBUG: [[R]:[KTOR]:[ExclusionRequestRateLimiter]] [REQUEST]:PATCH:/channels/{channel.id}/messages/{message.id} params:[{channel.id}=1191449585458094180,{message.id}=1274360378347884575] body:{"content":"Gateway: 39.631ms\nREST: 10.773614199s"}
TRACE: [] [Http/Ktor: Curl] <- PATCH https://discord.com/api/v10/channels/1191449585458094180/messages/1274360378347884575
TRACE: [] Received raw frame: Frame BINARY (fin=true, buffer len = 91)
TRACE: [] Gateway <<< {"t":"MESSAGE_UPDATE","s":4,"op":0,"d":{"content":"y.ping", ...}
TRACE: [] [DISCOVERED]:[BUCKET]:Bucket discovered for 3df15bae86f6647dd4dfcbd5c6949480
TRACE: [] [Http/Ktor: Curl] <- PATCH https://discord.com/api/v10/channels/1191449585458094180/messages/1274360378347884575 200 OK - 10.153825131s
DEBUG: [[R]:[KTOR]:[ExclusionRequestRateLimiter]] [RESPONSE]:200:PATCH:https://discord.com/api/v10/channels/1191449585458094180/messages/1274360378347884575 body:{"content":"Gateway: 39.631ms\nREST: 10.773614199s", ...}
[] [DISCOVERED]:[BUCKET]:Bucket discovered for 3df15bae86f6647dd4dfcbd5c6949480
TRACE: [] [Http/Ktor: Curl] <- POST https://discord.com/api/v10/channels/1191449585458094180/messages 200 OK - 10.772144703s
DEBUG: [[R]:[KTOR]:[ExclusionRequestRateLimiter]] [RESPONSE]:200:POST:https://discord.com/api/v10/channels/1191449585458094180/messages body:{"content":"Calculating...", ...}
DEBUG: [[R]:[KTOR]:[ExclusionRequestRateLimiter]] [REQUEST]:PATCH:/channels/{channel.id}/messages/{message.id} params:[{channel.id}=1191449585458094180,{message.id}=1274360378347884575] body:{"content":"Gateway: 39.631ms\nREST: 10.773614199s"}
TRACE: [] [Http/Ktor: Curl] <- PATCH https://discord.com/api/v10/channels/1191449585458094180/messages/1274360378347884575
TRACE: [] Received raw frame: Frame BINARY (fin=true, buffer len = 91)
TRACE: [] Gateway <<< {"t":"MESSAGE_UPDATE","s":4,"op":0,"d":{"content":"y.ping", ...}
TRACE: [] [DISCOVERED]:[BUCKET]:Bucket discovered for 3df15bae86f6647dd4dfcbd5c6949480
TRACE: [] [Http/Ktor: Curl] <- PATCH https://discord.com/api/v10/channels/1191449585458094180/messages/1274360378347884575 200 OK - 10.153825131s
DEBUG: [[R]:[KTOR]:[ExclusionRequestRateLimiter]] [RESPONSE]:200:PATCH:https://discord.com/api/v10/channels/1191449585458094180/messages/1274360378347884575 body:{"content":"Gateway: 39.631ms\nREST: 10.773614199s", ...}
viztea
viztea5w ago
yeah curl moment yeah this is happening to me as well
viztea
viztea5w ago
lmao
No description
viztea
viztea5w ago
it's weird though, some requests go through instantly like that 'Connected to message'
vyfor
vyfor5w ago
hmm i'll go ahead and test ktor itself
Want results from more Discord servers?
Add your server