HTTP-Adapter: IllegalStateException: Response has already been written
See original GitHub issueThe HTTP adapter showed this error in the logs:
DEBUG VertxBasedHttpProtocolAdapter failed to send http response for [EVENT] message from device [tenantId: test, deviceId: test_123]: response already closed
WARN JaegerSpan Span has already been finished; will not be reported again.
WARN TracingHelper An unexpected error occurred!
java.lang.IllegalStateException: Response has already been written
at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:394)
at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:382)
at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:451)
at org.eclipse.hono.adapter.http.AbstractVertxBasedHttpProtocolAdapter.lambda$doUploadMessage$31(AbstractVertxBasedHttpProtocolAdapter.java:738)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
HTTP-Adapter: IllegalStateException: Response has already ...
The HTTP adapter showed this error in the logs: DEBUG VertxBasedHttpProtocolAdapter failed to send http response for [EVENT] message from ...
Read more >Vertx throws IllegalStateException : Response has already ...
A handler is registered on the api endpoint which will write to the response. ... This answer is specific to exception "response has...
Read more >Why am i getting "java.lang.IllegalStateException: Response ...
IllegalStateException : Response has already been written". private void getMetadataFromFileList(RoutingContext context) {. this.fileSystem.
Read more >httpConnector Error Message is Displayed
When starting an application that refers to a httpConnector shared resource, an error is generated. java.lang.IllegalStateException: Cannot start endpoint ...
Read more >www.cs.cmu.edu/afs/qatar.cmu.edu/system/src/host/t...
Realms: Refactor MemoryRealm and JDBCRealm so that common code is in a ... HttpConnector: It is now possible to disable lookups of the...
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
So that means that the
Future
result from the precedingcompose
block isn’t getting succeeded. In fact, since therecover
block below apparently isn’t entered as well (nocannot process
message in your logs above), thisFuture
isn’t completed at all, if thehono-ttd
request is cancelled by the device.I would have guessed that this could mean a memory leak, but according to some tests I’ve done here this doesn’t seem to be the case. Nonetheless I think this is something that should be corrected, letting the Future be completed when the request gets closed by the device prematurely.
In any case, the above tests seem to show that reproducing the error described in this issue isn’t that easy. My guess here would be that you would need to send a
hono-ttd
request and actually send a command message in response to that and then, while this block https://github.com/eclipse/hono/blob/5a3ae23bb73be5a5d123eba7f43447a0b6c7c58e/adapters/http-base/src/main/java/org/eclipse/hono/adapter/http/AbstractVertxBasedHttpProtocolAdapter.java#L685-L694 is being processed (i.e. while anunregister-cmd-consumer
request is sent to the Command Router), the client has to cancel the request. In order to achieve this, it could help to add some delay (in the form of a vert.x timer execution) in the above block when testing this.Sure 😃