HttpServer stops responding on linux after one resuqest
- Dominant language
- Kotlin
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Configuration
> Kotlin: 1.7.20
> implementation("com.soywiz.korlibs.korio:korio:3.2.0")
> implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
> kotlin.native.binary.memoryModel=experimental
```
fun main() {
GlobalScope.launch(Dispatchers.Default) {
httpServer()
}
while(true){}
}
suspend fun httpServer(){
val server = createHttpServer{
errorHandler {
println("Http server error: ${it.message}")
}
this.allHandler {
println("Does this print: ${it.uri}")
}
this.router {
this.handler("/"){
it.addHeader("Content-Type", MimeType.APPLICATION_JSON.mime)
//it.setStatus(200)
it.end(json.encodeToString(response))
}
}
withContext(context = coroutineContext){
}
listen(7878, "0.0.0.0")
}
val httpUrl = URL("http://${server.actualHost}:${server.actualPort}/")
println("====================================")
println("HttpServer Listening on: $httpUrl")
println("====================================")
}
```
First time someone calls the endpoint json is shown and we get status 200.
After the first request the server stops responding, Why is that?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supplied createHttpServer example and reproduce the Linux behavior by making more than one request. Inspect the HTTP server request and connection lifecycle to determine why it stops responding after the first request. Done means the server handles repeated requests and the behavior is covered by an appropriate regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100