mc-router icon indicating copy to clipboard operation
mc-router copied to clipboard

error with docker swarm deployment

Open Fufu-btw opened this issue 2 years ago • 2 comments

Hello, I'm currently facing an issue with the deployment of mc-router on docker-swarm. Here is the command to create the service :

docker service create --name routeur --publish 25565:25565  --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock --restart-condition any --network mc-router_net --replicas 1 itzg/mc-router:latest --in-docker-swarm

And the service fail to start a couple of time :

routeur.1.h02ptte8siuu@srv-manager02    | time="2023-06-19T19:20:02Z" level=info msg="Listening for Minecraft client connections" listenAddress=":25565"
routeur.1.h02ptte8siuu@srv-manager02    | panic: runtime error: invalid memory address or nil pointer dereference
routeur.1.h02ptte8siuu@srv-manager02    | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1117de3]
routeur.1.h02ptte8siuu@srv-manager02    | 
routeur.1.h02ptte8siuu@srv-manager02    | goroutine 1 [running]:
routeur.1.h02ptte8siuu@srv-manager02    | github.com/itzg/mc-router/server.(*dockerWatcherImpl).listServices(0x1e3ba40, {0x157c080, 0xc0004ae500})
routeur.1.h02ptte8siuu@srv-manager02    |       /home/runner/work/mc-router/mc-router/server/docker.go:176 +0x6c3
routeur.1.h02ptte8siuu@srv-manager02    | github.com/itzg/mc-router/server.(*dockerWatcherImpl).StartInSwarm(0x1e3ba40, 0x0, 0xf)
routeur.1.h02ptte8siuu@srv-manager02    |       /home/runner/work/mc-router/mc-router/server/docker.go:75 +0x253
routeur.1.h02ptte8siuu@srv-manager02    | main.main()
routeur.1.h02ptte8siuu@srv-manager02    |       /home/runner/work/mc-router/mc-router/cmd/mc-router/main.go:146 +0xa09

Server info :

#uname -a
Linux srv-manager01 5.10.0-23-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12) x86_64 GNU/Linux
#docker -v 
Docker version 24.0.2, build cb74dfc
#os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/

No update pending, everything is up to date and the container was pulled 2minutes ago.

I'm facing the same issue when running the binary available on this github ( version 1.18 ) Do you know how can i fix it ?

Regards, Tom

Fufu-btw avatar Jun 19 '23 19:06 Fufu-btw

Looks like it'll probably take a code fix.

Just noting that more nil checking is needed here

https://github.com/itzg/mc-router/blob/ff7ef24f4cd0ca9b7eb0d7436ffd27a4066917f4/server/docker.go#L176

itzg avatar Jun 19 '23 19:06 itzg

Ty for your answer If it can help, i compiled it on the machine, and i still have these segfault :

admin@srv-manager01:/tmp$ sudo ./mc-router -in-docker-swarm
INFO[0000] Listening for Minecraft client connections    listenAddress=":25565"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10a847b]

goroutine 1 [running]:
github.com/itzg/mc-router/server.(*dockerWatcherImpl).listServices(0x1dc6660, {0x151ba38, 0xc0005c4140})
        /tmp/mc-router/mc-router/server/docker.go:176 +0x59b
github.com/itzg/mc-router/server.(*dockerWatcherImpl).StartInSwarm(0x1dc6660, 0x0, 0xf)
        /tmp/mc-router/mc-router/server/docker.go:75 +0x253
main.main()
        /tmp/mc-router/mc-router/cmd/mc-router/main.go:146 +0xa09

Fufu-btw avatar Jun 19 '23 20:06 Fufu-btw