ktorio / ktorio/ktor

Slow client is leading to lost connection

Open
#257 13 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
14.5k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
49

Description

I have two issues. The major one is connection lost. I have a client that consumes a big text stream at low speed. For example 100Kbps. After some time the client loses its connection to the server. Usually, it happens after that the client has downloaded 8Mb.

On server side is nothing, no any logs or exceptions or something else. I just can't get any debug information for this case an this is the second issue. Even in the trace mode, netty does not make any output for connections or others actions and ktor also, except startup log.

In opposite to netty, with jetty everything is ok except it does not have flush implementation and this is an issue to me.

I have couple questions:
How can I get debugging information from netty? And how I can eliminate disconnection on a slow client?

I tried to change write and idle timeout but no effect.
```
NettyApplicationEngine(kodein.instance()) {
configureBootstrap = {
ServerBootstrap().apply {
childOption(ChannelOption.SO_KEEPALIVE, true)
childHandler(IdleStateHandler(300, 300, 300))
childHandler(WriteTimeoutHandler(300, TimeUnit.SECONDS))
}
}
}
```

Ktor version 0.9.0

Contributor guide

Open the contributing guide

Research direction

Start at the NettyApplicationEngine configuration shown in the issue, including IdleStateHandler and WriteTimeoutHandler, and review how trace logging is enabled for Ktor 0.9.0. Reproduce the failure with a client consuming the stream at about 100Kbps, then determine why the connection closes and whether the server exposes useful diagnostic output. Done means the cause and a verified resolution are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.