Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when cachePreparedStatements is set to true #527

Closed
max-grigoriev opened this issue May 12, 2020 · 4 comments
Closed

Errors when cachePreparedStatements is set to true #527

max-grigoriev opened this issue May 12, 2020 · 4 comments

Comments

@max-grigoriev
Copy link

Vertx version: 3.9.0
Postgres: 9.6 (11.1)
JDK: Correto 11.0.7

When I enable prepared statement cache I received errors in my integration tests
io.vertx.pgclient.PgException: prepared statement "0000001" does not exist

at io.vertx.sqlclient.impl.SqlResultHandler.fail(SqlResultHandler.java:102)
	at io.vertx.sqlclient.impl.SqlResultHandler.handle(SqlResultHandler.java:88)
	at io.vertx.sqlclient.impl.SqlResultHandler.handle(SqlResultHandler.java:33)
	at io.vertx.sqlclient.impl.PoolBase$1.lambda$onSuccess$0(PoolBase.java:102)
	at io.vertx.sqlclient.impl.SocketConnectionBase.handleMessage(SocketConnectionBase.java:210)
	at io.vertx.sqlclient.impl.SocketConnectionBase.lambda$init$0(SocketConnectionBase.java:81)
	at io.vertx.core.net.impl.NetSocketImpl.lambda$new$2(NetSocketImpl.java:101)
	at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:237)
	at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:127)
	at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:357)
	at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:369)
	at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43)
	at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:232)
	at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:173)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
	at io.vertx.pgclient.impl.codec.PgEncoder.lambda$write$0(PgEncoder.java:77)
	at io.vertx.pgclient.impl.codec.PgCommandCodec.handleReadyForQuery(PgCommandCodec.java:137)
	at io.vertx.pgclient.impl.codec.PgDecoder.decodeReadyForQuery(PgDecoder.java:229)
	at io.vertx.pgclient.impl.codec.PgDecoder.channelRead(PgDecoder.java:87)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.kqueue.AbstractKQueueStreamChannel$KQueueStreamUnsafe.readReady(AbstractKQueueStreamChannel.java:544)
	at io.netty.channel.kqueue.AbstractKQueueChannel$AbstractKQueueUnsafe.readReady(AbstractKQueueChannel.java:381)
	at io.netty.channel.kqueue.KQueueEventLoop.processReady(KQueueEventLoop.java:211)
	at io.netty.channel.kqueue.KQueueEventLoop.run(KQueueEventLoop.java:289)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
	Suppressed: io.vertx.pgclient.PgException: prepared statement "0000001" does not exist
		at io.vertx.pgclient.impl.codec.ErrorResponse.toException(ErrorResponse.java:29)
		Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 

The problem is discovered when we run a couple of similar queries at the same time and then try to execute another one:

StepVerifier.create(Flux.merge(
                dao.addToRoom(new UserGroupRooms(111, 222, "test me", "me test", null, 0), 2),
                dao.addToRoom(new UserGroupRooms(111, 222, "test me", "me test", null, 0), 5),
                dao.addToRoom(new UserGroupRooms(111, 222, "test me", "me test", null, 0), 2),
                dao.addToRoom(new UserGroupRooms(111, 222, "test me", "me test", null, 0), 2)
                ).count()
        )
...
StepVerifier.create(dao.get(111, 222)... //fails
...

when I change Flux.merge to Flux.concat and queries run one by one then everything is OK.

@vietj
Copy link

vietj commented May 12, 2020

@max-grigoriev can you provide a reproducer project ?

@BillyYccc
Copy link
Member

BillyYccc commented May 12, 2020 via email

@max-grigoriev
Copy link
Author

max-grigoriev commented May 12, 2020

I can't reproduce this issue in 3.9.1-SNAPSHOT.

I'm not sure if it's related to eclipse-vertx/vertx-sql-client#590, would you like to try 3.9.1-SNAPSHOT and see if the problem still happens?

Do you have ETA for 3.9.1?
Thanks

@BillyYccc
Copy link
Member

The artifacts should be staged in these two days soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants