File close is done from the wrong thread
Got this thread warning from time to time due to AsyncFileImpl.close is called from Vert.x event loop.
2016-08-24 17:17:22,228 WARN io.vertx.core.impl.BlockedThreadChecker [vertx-blocked-thread-checker] Thread Thread[vert.x-eventloop-thread-1,5,main] has been blocked for 44689 ms, time limit is 2000 io.vertx.core.VertxException: Thread blocked
at sun.nio.ch.FileDispatcherImpl.close0(Native Method)
at sun.nio.ch.FileDispatcherImpl.close(FileDispatcherImpl.java:98)
at sun.nio.ch.SimpleAsynchronousFileChannelImpl.close(SimpleAsynchronousFileChannelImpl.java:102)
at io.vertx.core.file.impl.AsyncFileImpl.doClose(AsyncFileImpl.java:464)
at io.vertx.core.file.impl.AsyncFileImpl.lambda$closeInternal$5(AsyncFileImpl.java:482)
at io.vertx.core.file.impl.AsyncFileImpl$$Lambda$531/233412243.run(Unknown Source)
at io.vertx.core.file.impl.AsyncFileImpl.lambda$doWrite$0(AsyncFileImpl.java:153)
at io.vertx.core.file.impl.AsyncFileImpl$$Lambda$523/830092490.handle(Unknown Source)
at io.vertx.core.file.impl.AsyncFileImpl$1.lambda$completed$0(AsyncFileImpl.java:394)
at io.vertx.core.file.impl.AsyncFileImpl$1$$Lambda$525/1409392663.handle(Unknown Source)
at io.vertx.core.impl.ContextImpl.lambda$wrapTask$3(ContextImpl.java:359)
at io.vertx.core.impl.ContextImpl$$Lambda$122/405091754.run(Unknown Source)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:339)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:393)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742)
at java.lang.Thread.run(Thread.java:745)
hi, can you provide a reproducer ?
I don't know how to provide a reproducer for this one as the code works fine most of the time but when a disk is slow, it can block the event loop thread. It seems like close() is always called from the event loop thread which is probably wrong.
yep, it seems fairly easy to reproduce but never happens in tests.
Well... because close() is usually fast unless the disk is really busy
just noticed that this has been fixed already a few days ago https://github.com/eclipse/vert.x/issues/1573