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

"Needed to have 6 in buffer but only had 0" #899

Open
gavinking opened this issue Feb 22, 2021 · 13 comments
Open

"Needed to have 6 in buffer but only had 0" #899

gavinking opened this issue Feb 22, 2021 · 13 comments

Comments

@gavinking
Copy link

In the HR test suite I had to disable a test, as seen here:

https://github.com/hibernate/hibernate-reactive/blob/2ff95a963d18c863853f6258490d4ace341eb00c/hibernate-reactive-core/src/test/java/org/hibernate/reactive/OrderedEmbeddableCollectionTest.java#L32

because of an intermittent error that only occurred on DB2 when running the whole test suite (and not the single test).

From the error message it looks like this is something y'all know about already.

ERROR errors [vert.x-eventloop-thread-0] failed to execute statement [select orderedemb0_.id as id1_0_0_, orderedemb0_.title as title2_0_0_ from EAuthor orderedemb0_ where orderedemb0_.id=?]
ERROR errors [vert.x-eventloop-thread-0] could not load an entity: [org.hibernate.reactive.OrderedEmbeddableCollectionTest$Author#1]
java.util.concurrent.CompletionException: java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0. In JDBC we would normally block here but need to find a non-blocking solution
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331) ~[?:?]
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346) ~[?:?]
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:632) ~[?:?]
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) ~[?:?]
	at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088) ~[?:?]
	at org.hibernate.reactive.pool.impl.Handlers.lambda$toCompletionStage$0(Handlers.java:29) ~[main/:?]
	at io.vertx.sqlclient.impl.SqlResultHandler.fail(SqlResultHandler.java:103) ~[vertx-sql-client-3.9.5.jar:3.9.5]
	at io.vertx.sqlclient.impl.SqlResultHandler.handle(SqlResultHandler.java:89) ~[vertx-sql-client-3.9.5.jar:3.9.5]
	at io.vertx.sqlclient.impl.SqlResultHandler.handle(SqlResultHandler.java:33) ~[vertx-sql-client-3.9.5.jar:3.9.5]
	at io.vertx.sqlclient.impl.TransactionImpl.lambda$null$3(TransactionImpl.java:181) ~[vertx-sql-client-3.9.5.jar:3.9.5]
	at io.vertx.sqlclient.impl.TransactionImpl.lambda$rollback$2(TransactionImpl.java:140) ~[vertx-sql-client-3.9.5.jar:3.9.5]
	at io.vertx.sqlclient.impl.SocketConnectionBase.handleMessage(SocketConnectionBase.java:241) ~[vertx-sql-client-3.9.5.jar:3.9.5]
	at io.vertx.sqlclient.impl.SocketConnectionBase.lambda$init$0(SocketConnectionBase.java:88) ~[vertx-sql-client-3.9.5.jar:3.9.5]
	at io.vertx.core.net.impl.NetSocketImpl.lambda$new$2(NetSocketImpl.java:101) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:237) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:127) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:357) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:229) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:163) ~[vertx-core-3.9.5.jar:3.9.5]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.vertx.db2client.impl.codec.DB2Encoder.lambda$write$0(DB2Encoder.java:72) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.codec.DB2Decoder.decodePayload(DB2Decoder.java:97) [vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.codec.DB2Decoder.decode(DB2Decoder.java:53) [vertx-db2-client-3.9.5.jar:3.9.5]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) [netty-codec-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) [netty-codec-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) [netty-codec-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) [netty-transport-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [netty-common-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.49.Final.jar:4.1.49.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.49.Final.jar:4.1.49.Final]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.IllegalStateException: Needed to have 6 in buffer but only had 0. In JDBC we would normally block here but need to find a non-blocking solution
	at io.vertx.db2client.impl.drda.DRDAResponse.ensureALayerDataInBuffer(DRDAResponse.java:1462) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.drda.DRDAResponse.readDssHeader(DRDAResponse.java:878) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.drda.DRDAResponse.startSameIdChainParse(DRDAResponse.java:52) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.drda.DRDAQueryResponse.readDescribeInput(DRDAQueryResponse.java:81) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.drda.DRDAQueryResponse.readPrepareDescribeInputOutput(DRDAQueryResponse.java:53) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.codec.PrepareStatementCodec.decodePayload(PrepareStatementCodec.java:76) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	at io.vertx.db2client.impl.codec.DB2Decoder.decodePayload(DB2Decoder.java:80) ~[vertx-db2-client-3.9.5.jar:3.9.5]
	... 21 more
@gavinking gavinking added the bug label Feb 22, 2021
@vietj
Copy link
Member

vietj commented Feb 22, 2021

it's an issue I was not aware of and that is specific to DB2, I believe we need to engage with somebody familiar.

@vietj vietj added this to the 4.1.0 milestone Feb 22, 2021
@mswatosh
Copy link
Contributor

I'll start taking a look at this.

@vietj
Copy link
Member

vietj commented Feb 23, 2021 via email

@vietj
Copy link
Member

vietj commented Apr 26, 2021

@mswatosh any progress on this ?

@vietj vietj modified the milestones: 4.1.0, 4.1.1 Jun 1, 2021
@vietj
Copy link
Member

vietj commented Jun 3, 2021

@mswatosh have you had the chance to investigate this one ?

@vietj vietj modified the milestones: 4.1.1, 4.2.0 Jul 2, 2021
@mswatosh
Copy link
Contributor

It looks like the issue here is sometimes we haven't received the full response over the network, so this method (ensureALayerDataInBuffer) needs to be updated to 'wait' for enough of the response to continue, but without blocking the thread.

@tsegismont tsegismont modified the milestones: 4.2.0, 4.2.1 Oct 14, 2021
@vietj vietj modified the milestones: 4.2.1, 4.2.2 Nov 3, 2021
@vietj vietj modified the milestones: 4.2.2, 4.2.3, 4.2.4 Dec 14, 2021
@vietj vietj modified the milestones: 4.2.4, 4.2.5 Jan 20, 2022
@vietj vietj modified the milestones: 4.2.5, 4.2.6 Feb 16, 2022
@vietj vietj modified the milestones: 4.2.6, 4.2.7 Mar 17, 2022
@vietj vietj modified the milestones: 4.2.7, 4.2.8 Apr 13, 2022
@vietj vietj modified the milestones: 4.5.0, 4.5.1 Nov 15, 2023
@vietj vietj modified the milestones: 4.5.1, 4.5.2 Dec 13, 2023
@vietj vietj modified the milestones: 4.5.2, 4.5.3 Jan 30, 2024
@vietj vietj modified the milestones: 4.5.3, 4.5.4 Feb 6, 2024
@vietj vietj modified the milestones: 4.5.4, 4.5.5 Feb 22, 2024
@vietj vietj modified the milestones: 4.5.5, 4.5.6 Mar 14, 2024
@vietj vietj modified the milestones: 4.5.6, 4.5.7, 4.5.8 Mar 21, 2024
@vietj vietj modified the milestones: 4.5.8, 4.5.9 May 24, 2024
@vietj vietj modified the milestones: 4.5.9, 4.5.10 Jul 17, 2024
@vietj vietj modified the milestones: 4.5.10, 4.5.11 Sep 4, 2024
@vietj vietj modified the milestones: 4.5.11, 4.5.12 Nov 12, 2024
@yrodiere
Copy link

Hey @vietj @tsegismont , would you have time to investigate this in the foreseeable future? We currently need to disable tests in Hibernate Reactive because of it, and the list of disabled tests is growing... :)

@tsegismont
Copy link
Contributor

Unfortunately for DB2 we can't do much. We got experts contributing in the past but not recently

@vietj vietj modified the milestones: 4.5.12, 4.5.13 Jan 23, 2025
@vietj vietj modified the milestones: 4.5.13, 4.5.14 Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants