ktor connection is closed for a long polling requests (ConnectionClosedException)
See original GitHub issueKtor Version
1.1.3
Ktor Engine Used(client or server and name)
Apache Client
JVM Version, Operating System and Relevant Context
1.8
Feedback
I’m coming to this issue here after I initially thought that the problem is in underlying client (AsyncHttpClient): https://issues.apache.org/jira/browse/HTTPCLIENT-1980
After many investigations it looks like the problem is not in AsyncHttpClient but in ktor.
I’ve made a small reproducers that just perform constant GET requests to the same URL every 5 seconds. These reproducers were done using: HttpClient, AsyncHttpClient, Netty, vert.x Web Client and ktor.
All clients except ktor are working fine for multiple days (~4 days). Whereas ktor is stopping after some hours with ConnectionClosedException
:
Exception in thread "main" org.apache.http.ConnectionClosedException: Connection closed
at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.endOfInput(HttpAsyncRequestExecutor.java:345)
at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:261)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:121)
at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588)
at java.lang.Thread.run(Thread.java:748)
Do you need any logs to be done or how can I help you to find the cause?
Thank you!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:40 (13 by maintainers)
Top Results From Across the Web
ktor-network - client socket close throws exception on server ...
If a client connects and at some point the connection is closed by the client, an IOException is thrown, and caught, but the...
Read more >How to close connection just after getting Long Polling request ...
So I would like the algorithm to work like this: 1) Server get a long polling request. 2) If there is a data...
Read more >asyncio vs Ktor | What are the differences? - StackShare
What is Ktor? It is a framework for building asynchronous servers and clients in connected systems using the Kotlin programming language. Ktor Stats....
Read more >[FIXED] Getting Exceptions while running a Spring boot app ...
ConnectionClosedException : Connection is closed; nested exception is ElasticsearchException[java.util.concurrent.
Read more >Framework for quickly creating connected ... - AndroidRepo
If you find a security vulnerability in Ktor, we kindly request that you reach out to ... is closed for a long polling...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Leonid @e5l. Are there any news regarding the issue or possible milestones when it can be fixed? Thank you.
https://github.com/dtolstyi/ktor-issue-1066-reproducer