You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/05/01 17:34:14 UTC

[GitHub] [shardingsphere] TeslaCN opened a new issue #10237: PostgreSQLComBindPacket read data length more than actual column length

TeslaCN opened a new issue #10237:
URL: https://github.com/apache/shardingsphere/issues/10237


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Proxy
   
   ### Expected behavior
   
   
   ### Actual behavior
   ```
   [ERROR] 01:27:09.042 [pool-5-thread-1] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.IndexOutOfBoundsException: readerIndex(47) + length(2) exceeds writerIndex(47): PooledSlicedByteBuf(ridx: 47, widx: 47, cap: 47/47, unwrapped: PooledUnsafeDirectByteBuf(ridx: 69, widx: 69, cap: 464))
   	at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1477)
   	at io.netty.buffer.AbstractByteBuf.readShort(AbstractByteBuf.java:750)
   	at io.netty.buffer.AbstractByteBuf.readUnsignedShort(AbstractByteBuf.java:766)
   	at org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacketPayload.readInt2(PostgreSQLPacketPayload.java:60)
   	at org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.binary.bind.PostgreSQLComBindPacket.<init>(PostgreSQLComBindPacket.java:60)
   	at org.apache.shardingsphere.db.protocol.postgresql.packet.command.PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketFactory.java:53)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.getCommandPacket(PostgreSQLCommandExecuteEngine.java:56)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.getCommandPacket(PostgreSQLCommandExecuteEngine.java:47)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:92)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   ```
   
   
   ### Reason analyze (If you can)
   
   The parameter type is `POSTGRESQL_TYPE_INT8`, but
   the column's actual length (parameter value length) was 4 bytes. The `PostgreSQLInt8BinaryProtocolValue` read 8 bytes, which caused `IndexOutOfBoundsException`.
   
   ![image](https://user-images.githubusercontent.com/20503072/116790284-def89d80-aae5-11eb-89c0-be83ca290fc3.png)
   
   ![image](https://user-images.githubusercontent.com/20503072/116789950-5decd680-aae4-11eb-913a-05566fe69801.png)
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ```bash
   sysbench oltp_read_only        --db-driver=pgsql --pgsql-host=${PROXY_HOST} --pgsql-port=55432 --pgsql-user=root --pgsql-password='root' --pgsql-db=sbtest --tables=2 --table-size=10000 --report-interval=30  --time=180 --threads=1 --max-requests=0 --percentile=99  --range_selects=off --rand-type=uniform --auto_inc=off run
   ```
   
   ![image](https://user-images.githubusercontent.com/20503072/116790362-4adb0600-aae6-11eb-89ef-fc53ea949910.png)
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] TeslaCN closed issue #10237: PostgreSQLComBindPacket read data length more than actual column length

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #10237:
URL: https://github.com/apache/shardingsphere/issues/10237


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org