Skip to content

Invalid handshake message #15

@philippgille

Description

@philippgille

I'm sure the mistake is on my side or the reason is that Ignite version 2.7 is not officially supported yet, but maybe you can help me anyway.

I'm starting Ignite with Docker:

docker run -it --rm --name ignite -e "CONFIG_URI=https://raw.githubusercontent.com/apache/ignite/master/examples/config/example-cache.xml" -p 10800:10800 apacheignite/ignite

I don't want to run the container on the host network as in the example of the official documentation, and I only want to use the key-value functionality, so I only expose port 10800.

The server seems to work, which I tested with the following steps:

  1. I downloaded the binary distribution: apache-ignite-2.7.0-bin.zip and extracted it
  2. Went to C:\path\to\apache-ignite-2.7.0-bin\platforms\dotnet\examples\dotnetcore
  3. The code uses the full client by default (which starts a node), which we don't want, so I changed it to use the thin client. I added the following method to Program.cs:
    private static void MyTest()
    {
        var cfg = new IgniteClientConfiguration
        {
            Host = "127.0.0.1"
        };
    
        using (IIgniteClient client = Ignition.StartClient(cfg))
        {
            try
            {
                client.CreateCache<int, string>("cache");
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex);
            }
            ICacheClient<int, string> cache = client.GetCache<int, string>("cache");
            cache.Put(1, "Hello, World!");
    
            System.Console.WriteLine(cache.Get(1));
        }
    }
    And also called the method at the beginning of the main method.
  4. Execute dotnet run in the terminal.

This works: "Hello, World!" is printed and when executing multiple times the Docker container log contains a message that the cache "cache" already exists. So the connection is clearly working.

But when using the following Go code, it doesn't work:

package main

import (
	"crypto/tls"
	"fmt"
	"net"
	"time"

	"github.com/amsokol/ignite-go-client/binary/v1"
)

func main() {
	fmt.Println("hello world")

	connInfo := ignite.ConnInfo{
		Dialer: net.Dialer{
			Timeout: 2 * time.Second,
		},
		Host:    "localhost",
		Major:   1,
		Minor:   1,
		Network: "tcp",
		Port:    10800,
		TLSConfig: &tls.Config{
			InsecureSkipVerify: true,
		},
		// Go zero values for Username, Password and Patch
	}
	c, err := ignite.Connect(connInfo)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Connected: %v", c.Connected())
}

The output on the client side is:

hello world
panic: failed to open connection: EOF

goroutine 1 [running]:
main.main()
        C:/path/to/go/src/temp/main.go:31 +0x1b1
exit status 2

The output in the Docker container is:

[21:05:15,251][SEVERE][grid-nio-worker-client-listener-1-#30][ClientListenerProcessor] Closing NIO session because of unhandled exception.
class org.apache.ignite.IgniteCheckedException: Invalid handshake message
        at org.apache.ignite.internal.processors.odbc.ClientListenerNioServerBuffer.read(ClientListenerNioServerBuffer.java:115)
        at org.apache.ignite.internal.processors.odbc.ClientListenerBufferedParser.decode(ClientListenerBufferedParser.java:60)
        at org.apache.ignite.internal.processors.odbc.ClientListenerBufferedParser.decode(ClientListenerBufferedParser.java:40)
        at org.apache.ignite.internal.util.nio.GridNioCodecFilter.onMessageReceived(GridNioCodecFilter.java:114)
        at org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
        at org.apache.ignite.internal.util.nio.GridNioServer$HeadFilter.onMessageReceived(GridNioServer.java:3553)
        at org.apache.ignite.internal.util.nio.GridNioFilterChain.onMessageReceived(GridNioFilterChain.java:175)
        at org.apache.ignite.internal.util.nio.GridNioServer$ByteBufferNioClientWorker.processRead(GridNioServer.java:1132)
        at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.processSelectedKeysOptimized(GridNioServer.java:2389)
        at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:2156)
        at org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1797)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        at java.lang.Thread.run(Thread.java:748)

I thought maybe this is because version 2.7 introduced some changes to the handshake, so I started the Docker container for version 2.4.0, but that didn't work at all:

hello world
panic: failed to open connection: tls: DialWithDialer timed out

goroutine 1 [running]:
main.main()
        C:/path/to/go/src/temp/main.go:31 +0x1b1
exit status 2

Am I configuring the ConnInfo wrong? Or is version 2.7 just not working yet? Do you need more info from me? Can I help out somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions