-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.0.2
-
Component/s: Async
-
None
-
Environment:Windows 7, application built on Vertx 3 + Netty 4.0.28
I'm using the new Mongo RxJava async driver, and I'm running into issues when I run it through Netty.
When my application idles for about 1 minute without doing any database operation, in the next operation I'll get the following Exception:
com.mongodb.MongoSocketWriteException: Exception sending message at com.mongodb.connection.InternalStreamConnection.translateWriteException(InternalStreamConnection.java:462) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.InternalStreamConnection.access$1000(InternalStreamConnection.java:65) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.InternalStreamConnection$2.failed(InternalStreamConnection.java:320) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.netty.NettyStream$3.operationComplete(NettyStream.java:170) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.netty.NettyStream$3.operationComplete(NettyStream.java:166) ~[mongodb-driver-core-3.0.2.jar:?] at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:567) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetFailure(AbstractChannel.java:801) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:699) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1122) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:960) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357) [netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) [netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45] Caused by: java.nio.channels.ClosedChannelException 19:49:01,201 ERROR vert.x-eventloop-thread-4 com.ubi.petz.verticle.RestVerticle.lambda$processRequest$101(RestVerticle.java:367) - Error on Action: {"@class":"com.ubi.petz.action.SavePlayerAction","action_time":1,"inter_serial_num":2,"player_id":"test_id","name":"new name"} com.ubi.petz.exception.ActionException: com.mongodb.MongoSocketWriteException: Exception sending message at com.ubi.petz.verticle.RestVerticle.lambda$null$95(RestVerticle.java:272) ~[main/:?] at com.ubi.petz.verticle.RestVerticle$$Lambda$100/370109114.call(Unknown Source) ~[?:?] at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$1.onError(OperatorOnErrorResumeNextViaFunction.java:99) [rxjava-1.0.13.jar:1.0.13] at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.pollQueue(OperatorObserveOn.java:197) [rxjava-1.0.13.jar:1.0.13] at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber$2.call(OperatorObserveOn.java:170) [rxjava-1.0.13.jar:1.0.13] at com.ubi.petz.core.rx.VertxContextScheduler$WorkerImpl$TimedAction.run(VertxContextScheduler.java:108) [main/:?] at com.ubi.petz.core.rx.VertxContextScheduler$WorkerImpl$TimedAction.lambda$new$77(VertxContextScheduler.java:96) [main/:?] at com.ubi.petz.core.rx.VertxContextScheduler$WorkerImpl$TimedAction$$Lambda$42/715081036.handle(Unknown Source) [main/:?] at io.vertx.core.impl.ContextImpl.lambda$wrapTask$15(ContextImpl.java:314) [vertx-core-3.0.0.jar:?] at io.vertx.core.impl.ContextImpl$$Lambda$8/1127177174.run(Unknown Source) [vertx-core-3.0.0.jar:?] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357) [netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) [netty-common-4.0.28.Final.jar:4.0.28.Final] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45] Caused by: com.mongodb.MongoSocketWriteException: Exception sending message at com.mongodb.connection.InternalStreamConnection.translateWriteException(InternalStreamConnection.java:462) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.InternalStreamConnection.access$1000(InternalStreamConnection.java:65) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.InternalStreamConnection$2.failed(InternalStreamConnection.java:320) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.netty.NettyStream$3.operationComplete(NettyStream.java:170) ~[mongodb-driver-core-3.0.2.jar:?] at com.mongodb.connection.netty.NettyStream$3.operationComplete(NettyStream.java:166) ~[mongodb-driver-core-3.0.2.jar:?] at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:680) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:567) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:424) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetFailure(AbstractChannel.java:801) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:699) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1122) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:633) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext.access$1900(AbstractChannelHandlerContext.java:32) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:908) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:960) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:893) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) ~[netty-transport-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) ~[netty-common-4.0.28.Final.jar:4.0.28.Final] ... 1 more Caused by: java.nio.channels.ClosedChannelException
By looking at the stack trace you can't tell exactly which operation caused the error because of the asynchronous Observables, but the above Exception happened on MongoCollection.replaceOne() operation.
This happens 100% of the times, but only when I tell Mongo to use Netty (by calling System.setProperty("org.mongodb.async.type", "netty") as mentioned in the docs). It happens on read operations as well.
If Mongo doesn't use Netty, everything runs perfectly well.
My application is already using Netty for network I/O, so I thought I'd leverage it with MongoDB for increased performance.
Could this be an issue on the driver?
I'm using the 3.0.2 Java driver, on top of the RxJava 1.0.1 driver. Running MongoDB 2.6.7. Netty 4.0.28.
As this is a very young driver, I understand there may still be bugs, and I'd be glad if this stack trace could be of any use to identify them.