java.lang.IllegalStateException: File handle is closed

161 views
Skip to first unread message

Brucey

unread,
Oct 20, 2016, 9:43:39 AM10/20/16
to vert.x
Hallo,

We are having an issue posting multipart form data to our vertx rest service, which results in the following error :

Oct 20, 2016 11:41:16 AM io.vertx.core.impl.ContextImpl
SEVERE: Unhandled exception
java.lang.IllegalStateException: File handle is closed
at io.vertx.core.file.impl.AsyncFileImpl.checkClosed(AsyncFileImpl.java:450)
at io.vertx.core.file.impl.AsyncFileImpl.check(AsyncFileImpl.java:445)
at io.vertx.core.file.impl.AsyncFileImpl.closeInternal(AsyncFileImpl.java:474)
at io.vertx.core.file.impl.AsyncFileImpl.close(AsyncFileImpl.java:117)
at io.vertx.core.http.impl.HttpServerFileUploadImpl.handleComplete(HttpServerFileUploadImpl.java:203)
at io.vertx.core.http.impl.HttpServerFileUploadImpl.resume(HttpServerFileUploadImpl.java:128)
at io.vertx.core.http.impl.HttpServerFileUploadImpl.resume(HttpServerFileUploadImpl.java:38)
at io.vertx.core.streams.impl.PumpImpl.lambda$new$0(PumpImpl.java:62)
at io.vertx.core.file.impl.AsyncFileImpl.checkDrained(AsyncFileImpl.java:285)
at io.vertx.core.file.impl.AsyncFileImpl.lambda$doWrite$0(AsyncFileImpl.java:151)
at io.vertx.core.file.impl.AsyncFileImpl$1.lambda$completed$0(AsyncFileImpl.java:394)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:316)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:440)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Thread.java:745)

The form data consists of 3 file attachments, one of which can be quite large, in the 100's of kb.

The exception comes from the depths of the file upload handling code, and appears to be the result of a file being closed twice.

Unfortunately, the exception never makes it as far as my handler on the router, which results in the client never receiving a response to the request, and which will eventually idle time out.

The original problem comes from our php/curl client, but I've managed to replicate it with Apache HttpClient, so I assume our code is fine and the issue is in vertx (but I'm more than happy to have my assumptions crushed :-).



I raised an issue and something which demonstrates it.

Thanks!

Brucey
Reply all
Reply to author
Forward
0 new messages