Skip to content

IP6 always returns - .... connect: invalid argument #4169

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

Closed
krasi-georgiev opened this issue Jan 22, 2021 · 8 comments
Closed

IP6 always returns - .... connect: invalid argument #4169

krasi-georgiev opened this issue Jan 22, 2021 · 8 comments

Comments

@krasi-georgiev
Copy link

krasi-georgiev commented Jan 22, 2021

google.golang.org/grpc v1.36.0-dev.0.20210122012134-2c42474aca0c
go version go1.15.6 linux/arm
linux rpi
	lis, err := net.Listen("tcp", ":9999")
	if err != nil {
		return errors.Wrapf(err, "create network listener")
	}
	s := grpc.NewServer()

	RegisterAudiorServer(s, &Server{})
	reflection.Register(s)

	func (self *Server) Record(ctx context.Context, req *Request) (*Response, error) {
		fmt.Println("called!!!!")
		return &Response{ErrorType: "audior"}, nil

	}
syntax = "proto3";
package audior;


service Audior {
  rpc Record (Request) returns (Response) {}
}

message Request{
  enum event {
    None = 0;
    AudioRecordStart = 1;
    AudioRecordStop = 2;
  }
  event Event = 1;
}

message Response {
  string ErrorType     = 1;
  string Error         = 2;
}
protoc --gofast_out=plugins=grpc:. pkg/node/audior/audior.proto

What did you expect to see?

It works with ip4 , but not ip6 , the same error when using grpccurl or calling from grpc client from go.

What did you see instead?

grpcurl -plaintext -d '{"Event": 2}' [fe80::6396:e2a6:8607:e10f]:9990 audior.Audior/Record
Failed to dial target host "[fe80::6396:e2a6:8607:e10f]:9990": dial tcp [fe80::6396:e2a6:8607:e10f]:9990: connect: invalid argument

netstat -tulpn | grep LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      556/sshd            
tcp        0      0 127.0.0.1:32903         0.0.0.0:*               LISTEN      9612/node           
tcp6       0      0 :::22                   :::*                    LISTEN      556/sshd            
tcp6       0      0 :::9990                 :::*                    LISTEN      12523/i360          
tcp6       0      0 :::9999                 :::*                    LISTEN      12523/i360          
root@raspberrypi:~/src/github.com/arribada/i360# ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::6396:e2a6:8607:e10f  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:d2:00:b6  txqueuelen 1000  (Ethernet)
        RX packets 312650  bytes 102090189 (97.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 1242
        TX packets 263220  bytes 52487031 (50.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

@menghanl
Copy link
Contributor

Can you turn on logs and see what that says: https://github.com/grpc/grpc-go#how-to-turn-on-logging

And it seems proxy is on in your environment. Try to turn that off?

@krasi-georgiev
Copy link
Author

There is no proxy. What made you think that there is proxy?

@krasi-georgiev
Copy link
Author

Here is the update with the verbose loggs.
I am running these commands on RPI. I am running grpccurl from the same host where the grpc server is running

The strange thing is that when running the command to ::1 is works as expected.

root@raspberrypi:~/src/github.com/arribada/i360# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::6396:e2a6:8607:e10f  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:d2:00:b6  txqueuelen 1000  (Ethernet)
        RX packets 575776  bytes 131128694 (125.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 1716
        TX packets 493991  bytes 93537129 (89.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 1048321  bytes 149810864 (142.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1048321  bytes 149810864 (142.8 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@raspberrypi:~/src/github.com/arribada/i360# grpcurl -plaintext -d '{"Event": 1}' [::1]:9999 audior.Audior/Record
INFO: 2021/01/25 11:38:27 [core] parsed scheme: ""
INFO: 2021/01/25 11:38:27 [core] scheme "" not registered, fallback to default scheme
INFO: 2021/01/25 11:38:27 [core] ccResolverWrapper: sending update to cc: {[{[::1]:9999  <nil> 0 <nil>}] <nil> <nil>}
INFO: 2021/01/25 11:38:27 [core] ClientConn switching balancer to "pick_first"
INFO: 2021/01/25 11:38:27 [core] Channel switches to new LB policy "pick_first"
INFO: 2021/01/25 11:38:27 [core] Subchannel Connectivity change to CONNECTING
INFO: 2021/01/25 11:38:27 [core] Subchannel picks a new address "[::1]:9999" to connect
INFO: 2021/01/25 11:38:27 [core] pickfirstBalancer: UpdateSubConnState: 0x280ec40, {CONNECTING <nil>}
INFO: 2021/01/25 11:38:27 [core] Channel Connectivity change to CONNECTING
INFO: 2021/01/25 11:38:27 [core] Subchannel Connectivity change to READY
INFO: 2021/01/25 11:38:27 [core] pickfirstBalancer: UpdateSubConnState: 0x280ec40, {READY <nil>}
INFO: 2021/01/25 11:38:27 [core] Channel Connectivity change to READY
{
  
}
INFO: 2021/01/25 11:38:28 [core] Channel Connectivity change to SHUTDOWN
INFO: 2021/01/25 11:38:28 [core] Subchannel Connectivity change to SHUTDOWN
root@raspberrypi:~/src/github.com/arribada/i360# grpcurl -plaintext -d '{"Event": 1}' [fe80::6396:e2a6:8607:e10f]:9999 audior.Audior/Record
INFO: 2021/01/25 11:38:38 [core] parsed scheme: ""
INFO: 2021/01/25 11:38:38 [core] scheme "" not registered, fallback to default scheme
INFO: 2021/01/25 11:38:38 [core] ccResolverWrapper: sending update to cc: {[{[fe80::6396:e2a6:8607:e10f]:9999  <nil> 0 <nil>}] <nil> <nil>}
INFO: 2021/01/25 11:38:38 [core] ClientConn switching balancer to "pick_first"
INFO: 2021/01/25 11:38:38 [core] Channel switches to new LB policy "pick_first"
INFO: 2021/01/25 11:38:38 [core] Subchannel Connectivity change to CONNECTING
INFO: 2021/01/25 11:38:38 [core] Subchannel picks a new address "[fe80::6396:e2a6:8607:e10f]:9999" to connect
INFO: 2021/01/25 11:38:38 [core] pickfirstBalancer: UpdateSubConnState: 0x280f580, {CONNECTING <nil>}
WARNING: 2021/01/25 11:38:38 [core] grpc: addrConn.createTransport failed to connect to {[fe80::6396:e2a6:8607:e10f]:9999 [fe80::6396:e2a6:8607:e10f]:9999 <nil> 0 <nil>}. Err: connection error: desc = "transport: error while dialing: dial tcp [fe80::6396:e2a6:8607:e10f]:9999: connect: invalid argument". Reconnecting...
INFO: 2021/01/25 11:38:38 [core] Channel Connectivity change to CONNECTING
Failed to dial target host "[fe80::6396:e2a6:8607:e10f]:9999": dial tcp [fe80::6396:e2a6:8607:e10f]:9999: connect: invalid argument
root@raspberrypi:~/src/github.com/arribada/i360# 

@krasi-georgiev
Copy link
Author

I think it might have something to do with the fact that the ip6 address is fe80 - link local.

@menghanl
Copy link
Contributor

What made you think that there is proxy?

I thought the connect: error was from HTTP CONNECT. But it seems I was wrong.

I think it might have something to do with the fact that the ip6 address is fe80 - link local.

This sound right. Try to specify zone_index?

@krasi-georgiev
Copy link
Author

Yeah I already tried it after reading that article as well, but didn't make any difference 😞

@menghanl
Copy link
Contributor

Does net.Dial work with that address? If not, you may want to seek help in the golang repo.

@krasi-georgiev
Copy link
Author

yep good point, I tried it with the same results so opened an issue on golang repo
golang/go#43950

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants