You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Andrey Khitrin (Jira)" <ji...@apache.org> on 2022/10/21 14:12:00 UTC

[jira] [Created] (IGNITE-17953) NPE and closed connection on some malformed SQL requests using third-party SQL clients

Andrey Khitrin created IGNITE-17953:
---------------------------------------

             Summary: NPE and closed connection on some malformed SQL requests using third-party SQL clients
                 Key: IGNITE-17953
                 URL: https://issues.apache.org/jira/browse/IGNITE-17953
             Project: Ignite
          Issue Type: Bug
          Components: sql
            Reporter: Andrey Khitrin
             Fix For: 3.0.0-beta1


I try to run different SQL queries in AI3 using [SqlLine|https://github.com/julianhyde/sqlline] tool and fresh ignite-client JAR downloaded from CI. I tried both correct and some incorrect SQL queries. And it looks like some incorrect SQL queries lead to irrecoverable error on the client side. The stack trace is the following:
{code:java}
Oct 21, 2022 4:57:02 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.NullPointerException
        at org.apache.ignite.lang.ErrorGroup.errorMessage(ErrorGroup.java:193)
        at org.apache.ignite.lang.IgniteException.<init>(IgniteException.java:190)
        at org.apache.ignite.internal.client.TcpClientChannel.readError(TcpClientChannel.java:336)
        at org.apache.ignite.internal.client.TcpClientChannel.processNextMessage(TcpClientChannel.java:301)
        at org.apache.ignite.internal.client.TcpClientChannel.onMessage(TcpClientChannel.java:160)
        at org.apache.ignite.internal.client.io.netty.NettyClientConnection.onMessage(NettyClientConnection.java:94)
        at org.apache.ignite.internal.client.io.netty.NettyClientMessageHandler.channelRead(NettyClientMessageHandler.java:34)
        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.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:299)
        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.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
        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:829)

Oct 21, 2022 4:58:07 PM io.netty.channel.DefaultChannelPipeline onUnhandledInboundException
WARNING: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.io.IOException: Connection reset by peer
        at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
        at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
        at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
        at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:356)
        at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:258)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
        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:829)
{code}
The worst consequence of this error is that connection got broken (see Netty errors) and client process do not react on any user action anymore. The only thing I can do with it is to kill a whole process.

Even a simple typo in a query could lead to such error:
{code:sql}
-- prOmary instead of prImary
create table xx (my_column int promary key);
-- More examples:
-- POSITION function that exists in AI2
select POSITION('s', 'Some string here') as result;
-- or even such simple: PK + not null
create table xx (key_field INT PRIMARY KEY NOT NULL);{code}
This error is not reproduced in Ignite CLI itelf, but I'm afraid any third-party client that uses `ignite-client` jar could be affected.
h3. Steps to reproduce

1. Download and install AI3
2. Create AI3 node and initialize cluster
3. Connect to cluster using SqlLine
4. Run some queries

To run SqlLine, I use the following command:
{code:bash}
java -cp "sqlline-1.12.0-jar-with-dependencies.jar:<ai3-repository>/org/apache/ignite/ignite-client/3.0.0-SNAPSHOT/ignite-client-3.0.0-SNAPSHOT.jar:<IGNITE_HOME>/ignite-bin/3.0.0-SNAPSHOT/libs/*" \
sqlline.SqlLine -d org.apache.ignite.jdbc.IgniteJdbcDriver --color=true --verbose=true --showWarnings=true --showNestedErrs=true -u jdbc:ignite:thin://127.0.0.1/
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)