question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.IllegalStateException: ReadListener already set

See original GitHub issue

I have a long running request (>1min). At some point the server just crashes with the following breakpoint. Even if I just put a “thread only” suspending breakpoint in the post body it crashes

java.lang.IllegalStateException: ReadListener already set
    at org.eclipse.jetty.server.HttpInput.setReadListener(HttpInput.java:600) ~[jetty-server-9.3.13.v20161014.jar:9.3.13.v20161014]
    at org.jetbrains.ktor.servlet.ServletReadChannel.read(ServletReadChannel.kt:45) ~[ktor-servlet-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.nio.AsyncReadChannelAdapterStream.read(Channels.kt:114) ~[ktor-core-0.2.3.jar:0.2.3]
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284) ~[na:1.8.0_60]
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326) ~[na:1.8.0_60]
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) ~[na:1.8.0_60]
    at java.io.InputStreamReader.read(InputStreamReader.java:184) ~[na:1.8.0_60]
    at java.io.Reader.read(Reader.java:140) ~[na:1.8.0_60]
    at kotlin.io.TextStreamsKt.copyTo(ReadWrite.kt:116) ~[kotlin-stdlib-1.0.5.jar:1.0.5]
    at kotlin.io.TextStreamsKt.copyTo$default(ReadWrite.kt:113) ~[kotlin-stdlib-1.0.5.jar:1.0.5]
    at kotlin.io.TextStreamsKt.readText(ReadWrite.kt:100) ~[kotlin-stdlib-1.0.5.jar:1.0.5]
    at org.jetbrains.ktor.request.RequestContent$contentAsString$2.invoke(RequestContent.kt:11) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.request.RequestContent$contentAsString$2.invoke(RequestContent.kt:10) ~[ktor-core-0.2.3.jar:0.2.3]
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131) ~[kotlin-stdlib-1.0.5.jar:1.0.5]
    at org.jetbrains.ktor.request.RequestContent.getContentAsString(RequestContent.kt) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.request.RequestContent.get(RequestContent.kt:37) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.request.RequestContent$computedValuesMap$2.invoke(RequestContent.kt:49) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.request.RequestContent$computedValuesMap$2.invoke(RequestContent.kt:10) ~[ktor-core-0.2.3.jar:0.2.3]
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131) ~[kotlin-stdlib-1.0.5.jar:1.0.5]
    at org.jetbrains.ktor.request.RequestContent.getComputedValuesMap(RequestContent.kt) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.request.RequestContent.get(RequestContent.kt:38) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.host.BaseApplicationCall$parameters$2.invoke(BaseApplicationCall.kt:185) ~[ktor-hosts-common-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.host.BaseApplicationCall$parameters$2.invoke(BaseApplicationCall.kt:13) ~[ktor-hosts-common-0.2.3.jar:0.2.3]
    at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131) ~[kotlin-stdlib-1.0.5.jar:1.0.5]
    at org.jetbrains.ktor.host.BaseApplicationCall.getParameters(BaseApplicationCall.kt) ~[ktor-hosts-common-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.routing.Routing.interceptor(Routing.kt:10) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.routing.Routing.access$interceptor(Routing.kt:7) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt:28) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt:23) ~[ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.pipeline.PipelineMachine.runAction(PipelineMachine.kt:113) [ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.pipeline.PipelineMachine.loop(PipelineMachine.kt:105) [ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.pipeline.PipelineMachine.proceed(PipelineMachine.kt:25) [ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.pipeline.PipelineMachine.execute(PipelineMachine.kt:16) [ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.pipeline.AsyncKt$executeOn$1.get(Async.kt:30) [ktor-core-0.2.3.jar:0.2.3]
    at org.jetbrains.ktor.pipeline.AsyncKt$executeOn$1.get(Async.kt) [ktor-core-0.2.3.jar:0.2.3]
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) [na:1.8.0_60]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_60]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_60]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_60]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cy6erGn0mcommented, Nov 24, 2016

@mathiasbn Could you please try again with latest master?

0reactions
mathiasbncommented, Dec 1, 2016

It does.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.IllegalStateException: Already set read listener #483
Upon websocket connections from a remote client, I am getting a scenario where the TyrusHttpUpgradeHandler init method is being called twice, ...
Read more >
IllegalStateException cannot set WriteListener for non-async ...
I have a standard websocket endpoint based on Tyrus implementation which times to times triggers the java.lang.IllegalStateException: Cannot set ...
Read more >
[jetty-users] handling the same request multiple times? - Eclipse
When I put my Jetty server under high load, I sometimes get IllegalStateException being thrown mentioning “ReadListener already set”.
Read more >
org.glassfish.grizzly.servlet.HttpServletRequestImpl.isUpgrade java ...
Best Java code snippets using org.glassfish.grizzly.servlet. ... throw new IllegalStateException("The WriteListener has already been set.
Read more >
http4s/http4s - Gitter
Exception in thread "http4s-blaze-client-12" java.lang.IllegalStateException: ReadListener already set at org.eclipse.jetty.server.HttpInput.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found