Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Error when using GROUP BY in query #244

Open
jopvanraaij opened this issue Mar 9, 2018 · 3 comments
Open

Error when using GROUP BY in query #244

jopvanraaij opened this issue Mar 9, 2018 · 3 comments

Comments

@jopvanraaij
Copy link

jopvanraaij commented Mar 9, 2018

When executing a query with a GROUP BY, I get a stacktrace. It seems to be related to decoding of the message, but I'm not sure. Please see logging below (enabled trace for the code in the com.github.mauricio.async.db.mysql package.
Switched to the vertx JDBC driver, which works fine. Also with this failing GROUP BY query.

Using

  • Vertx 3.5.1
  • MySQL 3.7.21 5.5.54
  • Query: SELECT status as stat, count(*) AS myCount FROM relation GROUP BY status
15:51:16.978 [vert.x-eventloop-thread-0] DEBUG n.s.it.solutions.crm.DBVerticle.executeQuery(403) - Executing sql 'SELECT `status` as stat, count(*) AS myCount FROM `relation` GROUP BY `status`
15:51:16.979 [vert.x-eventloop-thread-4] TRACE c.g.m.a.d.m.c.MySQLOneToOneEncoder.encode(82) - Writing message com.github.mauricio.async.db.mysql.message.client.QueryMessage - 
0: 4f 00 00 00 03 53 45 4c     O . . . . S E L 
1: 45 43 54 20 60 73 74 61     E C T . ` s t a 
2: 74 75 73 60 20 61 73 20     t u s ` . a s . 
3: 73 74 61 74 2c 20 63 6f     s t a t , . c o 
4: 75 6e 74 28 2a 29 20 41     u n t ( * ) . A 
5: 53 20 6d 79 43 6f 75 6e     S . m y C o u n 
6: 74 20 46 52 4f 4d 20 60     t . F R O M . ` 
7: 72 65 6c 61 74 69 6f 6e     r e l a t i o n 
8: 60 20 47 52 4f 55 50 20     ` . G R O U P . 
9: 42 59 20 60 73 74 61 74     B Y . ` s t a t 
10: 75 73 60                    u s ` 
Total 83 bytes read

15:51:16.980 [vert.x-eventloop-thread-4] TRACE [frame-decoder][mysql-connection-1].decode(84) - Reading message type 2 - (count=4,hasDoneHandshake=true,size=1,isInQuery=true,processingColumns=true,processingParams=false,processedColumns=0,processedParams=0)
0: 02                          . 
Total 1 bytes read
}
15:51:16.980 [vert.x-eventloop-thread-1] DEBUG n.s.i.s.crm.handler.StatsHandler.getStats(77) - handling get stats - DONE
15:51:16.980 [vert.x-eventloop-thread-4] TRACE [frame-decoder][mysql-connection-1].decode(84) - Reading message type 3 - (count=5,hasDoneHandshake=true,size=51,isInQuery=true,processingColumns=true,processingParams=false,processedColumns=0,processedParams=0)
0: 03 64 65 66 03 63 72 6d     . d e f . c r m 
1: 08 72 65 6c 61 74 69 6f     . r e l a t i o 
2: 6e 08 72 65 6c 61 74 69     n . r e l a t i 
3: 6f 6e 04 73 74 61 74 06     o n . s t a t . 
4: 73 74 61 74 75 73 0c 53     s t a t u s . S 
5: 00 87 00 00 00 fd 09 50     . . . . . . . P 
6: 00 00 00                    . . . 
Total 51 bytes read
}
15:51:16.980 [vert.x-eventloop-thread-4] TRACE [frame-decoder][mysql-connection-1].decode(84) - Reading message type 3 - (count=6,hasDoneHandshake=true,size=29,isInQuery=true,processingColumns=true,processingParams=false,processedColumns=1,processedParams=0)
0: 03 64 65 66 00 00 00 07     . d e f . . . . 
1: 6d 79 43 6f 75 6e 74 00     m y C o u n t . 
2: 0c 3f 00 15 00 00 00 08     . ? . . . . . . 
3: 81 00 00 00 00              . . . . . 
Total 29 bytes read
}
15:51:16.981 [vert.x-eventloop-thread-4] TRACE [frame-decoder][mysql-connection-1].decode(84) - Reading message type -2 - (count=7,hasDoneHandshake=true,size=5,isInQuery=true,processingColumns=true,processingParams=false,processedColumns=2,processedParams=0)
0: fe 00 00 02 00              . . . . . 
Total 5 bytes read
}
15:51:16.981 [vert.x-eventloop-thread-4] TRACE [frame-decoder][mysql-connection-1].decode(84) - Reading message type 0 - (count=8,hasDoneHandshake=true,size=3,isInQuery=true,processingColumns=false,processingParams=false,processedColumns=2,processedParams=0)
0: 00 01 31                    . . 1 
Total 3 bytes read
}
15:51:16.983 [vert.x-eventloop-thread-4] ERROR c.g.m.async.db.mysql.MySQLConnection.exceptionCaught(119) - Transport failure 
java.lang.IndexOutOfBoundsException: readerIndex(3) + length(2) exceeds writerIndex(3): UnpooledSlicedByteBuf(ridx: 3, widx: 3, cap: 3/3, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf(ridx: 109, widx: 164, cap: 512))
	at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1403)
	at io.netty.buffer.AbstractByteBuf.readShort(AbstractByteBuf.java:726)
	at io.netty.buffer.SwappedByteBuf.readShort(SwappedByteBuf.java:541)
	at com.github.mauricio.async.db.mysql.decoder.OkDecoder.decode(OkDecoder.scala:31)
	at com.github.mauricio.async.db.mysql.codec.MySQLFrameDecoder.doDecoding(MySQLFrameDecoder.scala:172)
	at com.github.mauricio.async.db.mysql.codec.MySQLFrameDecoder.handleCommonFlow(MySQLFrameDecoder.scala:157)
	at com.github.mauricio.async.db.mysql.codec.MySQLFrameDecoder.decode(MySQLFrameDecoder.scala:90)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:141)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
@andy-yx-chen
Copy link

It says, MySQL 4.1 and above, but you are trying with 3.x

@jopvanraaij
Copy link
Author

Whoops, the MySQL version is actually 5.5.54. Not sure how that got mixed up. Other numbers are correct..

@andy-yx-chen
Copy link

looks like this project is dead, maybe just fork it and debug, fix it

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

No branches or pull requests

2 participants