Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

v0.17.14 can not run on Linux #32

Closed
songjiayang opened this issue Apr 19, 2019 · 8 comments
Closed

v0.17.14 can not run on Linux #32

songjiayang opened this issue Apr 19, 2019 · 8 comments

Comments

@songjiayang
Copy link

With default command options:

deploy@example:~/gortcd$ ./gortcd-pie 
{"level":"info","ts":1555665627.3852997,"msg":"config file used","path":"/home/deploy/gortcd/gortcd.yml"}
{"level":"info","ts":1555665627.3855886,"msg":"parsed credentials","n":0}
{"level":"info","ts":1555665627.3856893,"msg":"realm","k":"gortc.io"}
{"level":"info","ts":1555665627.385987,"logger":"filter.peer","msg":"default action set","action":"allow"}
{"level":"info","ts":1555665627.3861253,"logger":"filter.client","msg":"default action set","action":"allow"}
{"level":"info","ts":1555665627.386219,"msg":"will be sending SOFTWARE attribute","software":"gortcd"}
{"level":"info","ts":1555665627.386445,"msg":"got addr","addr":"0.0.0.0:3478"}
{"level":"warn","ts":1555665627.38652,"msg":"running on all interfaces"}
{"level":"warn","ts":1555665627.3866117,"msg":"picking addr from ICE"}
{"level":"warn","ts":1555665627.3869166,"msg":"got","a":"127.0.0.1 [45]"}
{"level":"warn","ts":1555665627.387017,"msg":"got","a":"10.162.58.13 [35]"}
{"level":"warn","ts":1555665627.3870754,"msg":"using","a":"10.162.58.13 [35]"}
{"level":"warn","ts":1555665627.3871744,"msg":"got","a":"218.244.128.99 [35]"}
{"level":"warn","ts":1555665627.387245,"msg":"using","a":"218.244.128.99 [35]"}
{"level":"info","ts":1555665627.3873508,"msg":"gortc/gortcd listening","addr":"218.244.128.99:3478","network":"udp"}
{"level":"fatal","ts":1555665627.387498,"msg":"failed to listen","error":"listen udp 218.244.128.99:3478: protocol not available"}

With different listened port:

deploy@binatify:~/gortcd$ ./gortcd-pie -l="0.0.0.0:3479"
{"level":"info","ts":1555665654.0974624,"msg":"config file used","path":"/home/deploy/gortcd/gortcd.yml"}
{"level":"info","ts":1555665654.0977643,"msg":"parsed credentials","n":0}
{"level":"info","ts":1555665654.0978677,"msg":"realm","k":"gortc.io"}
{"level":"info","ts":1555665654.0981438,"logger":"filter.peer","msg":"default action set","action":"allow"}
{"level":"info","ts":1555665654.0982912,"logger":"filter.client","msg":"default action set","action":"allow"}
{"level":"info","ts":1555665654.0983856,"msg":"will be sending SOFTWARE attribute","software":"gortcd"}
{"level":"info","ts":1555665654.0985594,"msg":"got addr","addr":"[0.0.0.0:3479]"}
{"level":"info","ts":1555665654.098647,"msg":"gortc/gortcd listening","addr":"[0.0.0.0:3479]","network":"udp"}
{"level":"fatal","ts":1555665654.0987477,"msg":"failed to listen","error":"listen udp: address [0.0.0.0:3479]: missing port in address"}

Is it a bug? it can work well on Mac OS.

@ernado
Copy link
Contributor

ernado commented May 5, 2019

Hi, server is trying to listen on all interfaces, but failing on one of them.

I'm not sure how to handle that sutiation.
We can't just listen on "0.0.0.0" like other software, because we need to know our interface address, so we are iterating on all interfaces.

You can try to listen only on "10.162.58.13:3478".
Seems like "-l" flag has weird format for this, because it accepts a list of addresses.

Sorry for late reply, I'll create some workaround for your case soon.

@ernado ernado closed this as completed in f799d9b May 6, 2019
@ernado
Copy link
Contributor

ernado commented May 6, 2019

Can you please try v0.18.3?

@songjiayang
Copy link
Author

Sorry late to reply, the problem still exist, to see:

Screen Shot 2019-05-09 at 11 05 55 AM

I changed the bind host port, but the same result.

Screen Shot 2019-05-09 at 11 08 19 AM

@ernado ernado reopened this May 9, 2019
@songjiayang
Copy link
Author

songjiayang commented May 10, 2019

If you want any information, Please let me known, here is my ifconfig:

Screen Shot 2019-05-10 at 10 11 29 AM

@ernado
Copy link
Contributor

ernado commented May 10, 2019

Hi, thank you for feedback.
I've tried one more time to catch that error.

Can you please try v0.18.4?
Sorry that it takes multiple iterations, I have no environment with such error to reproduce.

@songjiayang
Copy link
Author

Sorry to say, the problem existed. Y are right, my environment is not normal, I want to have a try to find the bug, is there a debug logger to find the error line?

@ernado
Copy link
Contributor

ernado commented May 11, 2019

Can you please run the following:

package main

import (
	"flag"
	"fmt"
	"net"
	"os"
	"syscall"
)

var addr = flag.String("listen", "218.244.128.99:3478", "listen addr")

func protocolNotSupported(err error) bool {
	switch err := err.(type) {
	case syscall.Errno:
		switch err {
		case syscall.EPROTONOSUPPORT, syscall.ENOPROTOOPT:
			return true
		}
	case *os.SyscallError:
		return protocolNotSupported(err.Err)
	case *net.OpError:
		return protocolNotSupported(err.Err)
	}
	return false
}

func main() {
	flag.Parse()
	c, err := net.ListenPacket("udp", *addr)
	if err != nil {
		fmt.Printf("ERR (not supported: %v): %v\n", protocolNotSupported(err), err)
		fmt.Printf("\t%#v\n", err)
		fmt.Printf("Type:\n\t%T\n", err)
	} else {
		fmt.Println("OK", c.LocalAddr())
	}
}

Sample output will be like that:

ERR (not supported: false): listen udp 218.244.128.99:3478: bind: cannot assign requested address
	&net.OpError{Op:"listen", Net:"udp", Source:net.Addr(nil), Addr:(*net.UDPAddr)(0xc000094510), Err:(*os.SyscallError)(0xc00009c080)}
Type:
	*net.OpError

The error line should be just net.ListenPacket, seems like for some reason one of interfaces on your system is not available.

Also please try to set server.reuseport in config to false, like that:

# ...
server:
# ...
  reuseport: true

@songjiayang
Copy link
Author

The code output is:

OK 218.244.128.99:3478

But change the config to reuseport: false , it works, thank you so much.

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