qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
7.96k stars 368 forks source link

Bug: runtime error: invalid memory address or nil pointer dereference #855

Closed DiamondPrecisionComputing closed 2 years ago

DiamondPrecisionComputing commented 2 years ago

Is this urgent?

Yes

Host OS

unRAID

CPU arch

x86_64

VPN service provider

Private Internet Access

What are you using to run the container

Other

What is the version of Gluetun

pr-848

What's the problem šŸ¤”

Container constantly restarts do to error after merging servers.json. Reverted back to "vpnsecure.me" tag does not yield the same error.

Share your logs

========================================
========================================
=============== gluetun ================
========================================
=========== Made with ā¤ļø by ============
======= https://github.com/qdm12 =======
========================================
========================================

Running version pr-848 built on 2022-02-20T03:27:48.093Z (commit dcba2bb)

šŸ”§ Need help? https://github.com/qdm12/gluetun/discussions/new
šŸ› Bug? https://github.com/qdm12/gluetun/issues/new
āœØ New feature? https://github.com/qdm12/gluetun/issues/new
ā˜• Discussion? https://github.com/qdm12/gluetun/discussions/new
šŸ’» Email? quentin.mcgaw@gmail.com
šŸ’° Help me? https://www.paypal.me/qmcgaw https://github.com/sponsors/qdm12
2022/02/20 01:25:21 WARN You are using the old environment variable VPNSP, please consider changing it to VPN_SERVICE_PROVIDER
2022/02/20 01:25:21 WARN You are using the old environment variable SERVER_HOSTNAME, please consider changing it to SERVER_HOSTNAMES
2022/02/20 01:25:21 WARN You are using the old environment variable WIREGUARD_ENDPOINT_PORT, please consider changing it to VPN_ENDPOINT_PORT
2022/02/20 01:25:21 WARN You are using the old environment variable OPENVPN_INTERFACE, please consider changing it to VPN_INTERFACE
2022/02/20 01:25:21 WARN You are using the old environment variable OPENVPN_ROOT, please consider changing it to OPENVPN_PROCESS_USER
2022/02/20 01:25:21 WARN You are using the old environment variable WIREGUARD_INTERFACE, please consider changing it to VPN_INTERFACE
2022/02/20 01:25:21 INFO routing: default route found: interface eth0, gateway 172.17.0.1
2022/02/20 01:25:21 INFO routing: local ethernet link found: gretap0
2022/02/20 01:25:21 INFO routing: local ethernet link found: erspan0
2022/02/20 01:25:21 INFO routing: local ethernet link found: eth0
2022/02/20 01:25:21 INFO routing: local ipnet found: 172.17.0.0/16
2022/02/20 01:25:21 INFO firewall: enabling...
2022/02/20 01:25:21 INFO firewall: enabled successfully
2022/02/20 01:25:21 INFO storage: merging by most recent 11173 hardcoded servers and 11173 servers read from /gluetun/servers.json
panic: runtime error: invalid memory address or nil pointer dereference

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x711a33]

goroutine 22 [running]:
github.com/qdm12/gluetun/internal/configuration/settings.OpenVPN.validate({{0xc000026208, 0x3}, {0xc0000261a5, 0x8}, {0xc000028051, 0xa}, 0xc00024e3f0, {0x0, 0x0, 0x0}, ...}, ...)
github.com/qdm12/gluetun/internal/configuration/settings/openvpn.go:112 +0x293
github.com/qdm12/gluetun/internal/configuration/settings.(*VPN).validate(_, {0x1, {0x4, 0x614c8660, {0xc00021c000, 0xb8, 0xb8}}, {0x1, 0x61f2977a, {0xc0000e4000, ...}}, ...})
github.com/qdm12/gluetun/internal/configuration/settings/vpn.go:38 +0x1f8
github.com/qdm12/gluetun/internal/configuration/settings.(*Settings).Validate.func1()
github.com/qdm12/gluetun/internal/configuration/settings/settings.go:45 +0x5f
github.com/qdm12/gluetun/internal/configuration/settings.(*Settings).Validate(_, {0x1, {0x4, 0x614c8660, {0xc00021c000, 0xb8, 0xb8}}, {0x1, 0x61f2977a, {0xc0000e4000, ...}}, ...})
github.com/qdm12/gluetun/internal/configuration/settings/settings.go:50 +0x990
main._main({0xd2ad98, 0xc00011a000}, {{0xd17408, 0x6}, {0xd176e8, 0x7}, {0xd19220, 0x18}}, {0xc00001e210, 0x1, ...}, ...)
./main.go:226 +0xca5
main.main.func1()
./main.go:87 +0x150
created by main.main
./main.go:86 +0x649

Share your configuration

docker run -d --name='gluetun_vpn' --net='bridge' --cpuset-cpus='2,3,4,5,6,22,23,24,25,26' -e TZ="America/Chicago" -e HOST_OS="Unraid" -e 'TZ'='America/Chicago' -e 'VPN_SERVICE_PROVIDER'='private internet access' -e 'VPN_TYPE'='openvpn' -e 'OPENVPN_PROTOCOL'='udp' -e 'OPENVPN_USER'='<<USERNAME>>' -e 'OPENVPN_PASSWORD'='<<PASSWORD>>' -e 'OPENVPN_VERSION'='2.5' -e 'OPENVPN_VERBOSITY'='1' -e 'OPENVPN_FLAGS'='' -e 'OPENVPN_CIPHER'='' -e 'OPENVPN_AUTH'='' -e 'OPENVPN_PROCESS_USER'='no' -e 'OPENVPN_TARGET_IP'='' -e 'OPENVPN_IPV6'='off' -e 'OPENVPN_CUSTOM_CONFIG'='' -e 'VPN_INTERFACE'='tun0' -e 'OPENVPN_PORT'='' -e 'WIREGUARD_PRIVATE_KEY'='' -e 'WIREGUARD_PRESHARED_KEY'='' -e 'WIREGUARD_PUBLIC_KEY'='' -e 'WIREGUARD_ADDRESS'='' -e 'WIREGUARD_ENDPOINT_IP'='' -e 'WIREGUARD_INTERFACE'='wg0' -e 'SERVER_REGIONS'='US Texas' -e 'COUNTRY'='' -e 'CITY'='' -e 'SERVER_HOSTNAME'='' -e 'FIREWALL'='on' -e 'FIREWALL_VPN_INPUT_PORTS'='6767,6881,7878,8080,8112,8686,8787,8989,9090,9696,17442,58846,58946' -e 'FIREWALL_INPUT_PORTS'='6767,6881,7878,8080,8112,8686,8787,8989,9090,9696,17442,58846,58946' -e 'FIREWALL_OUTBOUND_SUBNETS'='' -e 'FIREWALL_DEBUG'='off' -e 'LOG_LEVEL'='info' -e 'DOT'='on' -e 'DOT_PROVIDERS'='cloudflare' -e 'DOT_PRIVATE_ADDRESS'='127.0.0.1/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,169.254.0.0/16,::1/128,fc00::/7,fe80::/10,::ffff:7f00:1/104,::ffff:a00:0/104,::ffff:a9fe:0/112,::ffff:ac10:0/108,::ffff:c0a8:0/112' -e 'DOT_VERBOSITY'='1' -e 'DOT_VERBOSITY_DETAILS'='0' -e 'DOT_VALIDATION_LOGLEVEL'='0' -e 'DOT_CACHING'='on' -e 'DOT_IPV6'='off' -e 'BLOCK_MALICIOUS'='on' -e 'BLOCK_SURVEILLANCE'='off' -e 'BLOCK_ADS'='off' -e 'UNBLOCK'='jesseefamily.org,unraid.net,USENETSERVER.COM' -e 'DNS_UPDATE_PERIOD'='24h' -e 'DNS_PLAINTEXT_ADDRESS'='' -e 'DNS_KEEP_NAMESERVER'='on' -e 'HTTPPROXY'='off' -e 'HTTPPROXY_LOG'='off' -e 'HTTPPROXY_USER'='' -e 'HTTPPROXY_PASSWORD'='' -e 'HTTPPROXY_STEALTH'='off' -e 'SHADOWSOCKS'='on' -e 'SHADOWSOCKS_LOG'='off' -e ':8388'=':8388' -e 'SHADOWSOCKS_PASSWORD'='nmqcAq4EDMgyA9Ucs8zS' -e 'SHADOWSOCKS_CIPHER'='chacha20-ietf-poly1305' -e 'HEALTH_SERVER_ADDRESS'='127.0.0.1:9999' -e 'HEALTH_ADDRESS_TO_PING'='github.com' -e 'HEALTH_VPN_DURATION_INITIAL'='6s' -e 'HEALTH_VPN_DURATION_ADDITION'='5s' -e 'UPDATER_PERIOD'='0' -e 'PUBLICIP_FILE'='/gluetun/ip' -e 'PUBLICIP_PERIOD'='12h' -e 'VERSION_INFORMATION'='on' -e 'HTTP_CONTROL_SERVER_LOG'='on' -e 'PUID'='1000' -e 'PGID'='1000' -p '8888:8888/tcp' -p '58846:58846/tcp' -p '58946:58946/tcp' -p '58946:58946/udp' -p '8112:8112/tcp' -p '8080:8080/tcp' -p '7878:7878/tcp' -p '8989:8989/tcp' -p '8686:8686/tcp' -p '8787:8787/tcp' -p '6767:6767/tcp' -p '9696:9696/tcp' -p '17442:17442/tcp' -p '8000:8000/tcp' -v '/mnt/user/appdata/gluetun':'/gluetun':'rw' --cap-add=NET_ADMIN --restart always 'qmcgaw/gluetun'
cpt-kuesel commented 2 years ago

I also see the same error after upgrading to version pr848 just now. Host: Fedora Server CPU_Arch; x86_64 VPN: ProtonVPN Running docker-compose

Logs:


qbit_gluetun  | ========================================
qbit_gluetun  | =============== gluetun ================
qbit_gluetun  | ========================================
qbit_gluetun  | =========== Made with ā¤ļø by ============
qbit_gluetun  | ======= https://github.com/qdm12 =======
qbit_gluetun  | ========================================
qbit_gluetun  | ========================================
qbit_gluetun  |
qbit_gluetun  | Running version pr-848 built on 2022-02-20T03:27:48.093Z (commit dcba2bb)
qbit_gluetun  |
qbit_gluetun  | šŸ”§ Need help? https://github.com/qdm12/gluetun/discussions/new
qbit_gluetun  | šŸ› Bug? https://github.com/qdm12/gluetun/issues/new
qbit_gluetun  | āœØ New feature? https://github.com/qdm12/gluetun/issues/new
qbit_gluetun  | ā˜• Discussion? https://github.com/qdm12/gluetun/discussions/new
qbit_gluetun  | šŸ’» Email? quentin.mcgaw@gmail.com
qbit_gluetun  | šŸ’° Help me? https://www.paypal.me/qmcgaw https://github.com/sponsors/qdm12
qbit_gluetun  | 2022/02/20 08:56:12 INFO routing: default route found: interface eth0, gateway 172.17.0.1
qbit_gluetun  | 2022/02/20 08:56:12 INFO routing: local ethernet link found: eth0
qbit_gluetun  | 2022/02/20 08:56:12 INFO routing: local ipnet found: 172.17.0.0/16
qbit_gluetun  | 2022/02/20 08:56:12 INFO firewall: enabling...
qbit_gluetun  | 2022/02/20 08:56:12 INFO firewall: enabled successfully
qbit_gluetun  | 2022/02/20 08:56:12 INFO storage: merging by most recent 11173 hardcoded servers and 11173 servers read from /gluetun/servers.json
qbit_gluetun  | panic: runtime error: invalid memory address or nil pointer dereference
qbit_gluetun  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x711a33]
qbit_gluetun  |
qbit_gluetun  | goroutine 20 [running]:
qbit_gluetun  | github.com/qdm12/gluetun/internal/configuration/settings.OpenVPN.validate({{0xc000024070, 0x3}, {0xc00002602d, 0x10}, {0xc00002a011, 0x20}, 0xc00053a3a0, {0x0, 0x0, 0x0}, ...}, ...)
qbit_gluetun  |         github.com/qdm12/gluetun/internal/configuration/settings/openvpn.go:112 +0x293
qbit_gluetun  | github.com/qdm12/gluetun/internal/configuration/settings.(*VPN).validate(_, {0x1, {0x4, 0x614c8660, {0xc0002a6000, 0xb8, 0xb8}}, {0x1, 0x61f2977a, {0xc0000ae000, ...}}, ...})
qbit_gluetun  |         github.com/qdm12/gluetun/internal/configuration/settings/vpn.go:38 +0x1f8
qbit_gluetun  | github.com/qdm12/gluetun/internal/configuration/settings.(*Settings).Validate.func1()
qbit_gluetun  |         github.com/qdm12/gluetun/internal/configuration/settings/settings.go:45 +0x5f
qbit_gluetun  | github.com/qdm12/gluetun/internal/configuration/settings.(*Settings).Validate(_, {0x1, {0x4, 0x614c8660, {0xc0002a6000, 0xb8, 0xb8}}, {0x1, 0x61f2977a, {0xc0000ae000, ...}}, ...})
qbit_gluetun  |         github.com/qdm12/gluetun/internal/configuration/settings/settings.go:50 +0x990
qbit_gluetun  | main._main({0xd2ad98, 0xc0000ac040}, {{0xd17408, 0x6}, {0xd176e8, 0x7}, {0xd19220, 0x18}}, {0xc00001e210, 0x1, ...}, ...)
qbit_gluetun  |         ./main.go:226 +0xca5
qbit_gluetun  | main.main.func1()
qbit_gluetun  |         ./main.go:87 +0x150
qbit_gluetun  | created by main.main
qbit_gluetun  |         ./main.go:86 +0x649```
frepke commented 2 years ago

I'm also see the same error after upgrading to version pr-848. Host: Debian Bullseye CPU_Arch; x86_64 VPN: Surfshark Running docker-compose

fredssh commented 2 years ago
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x711a33]

goroutine 50 [running]:
github.com/qdm12/gluetun/internal/configuration/settings.OpenVPN.validate({{0xc0000240a0, 0x3}, {0xc00002800d, 0x18}, {0xc00002a011, 0xa}, 0xc00001efc0, {0x0, 0x0, 0x0}, ...}, ...)
        github.com/qdm12/gluetun/internal/configuration/settings/openvpn.go:112 +0x293
github.com/qdm12/gluetun/internal/configuration/settings.(*VPN).validate(_, {0x1, {0x4, 0x614c8660, {0xc00028c000, 0xb8, 0xb8}}, {0x1, 0x61f2977a, {0xc0001a6000, ...}}, ...})
        github.com/qdm12/gluetun/internal/configuration/settings/vpn.go:38 +0x1f8
github.com/qdm12/gluetun/internal/configuration/settings.(*Settings).Validate.func1()
        github.com/qdm12/gluetun/internal/configuration/settings/settings.go:45 +0x5f
github.com/qdm12/gluetun/internal/configuration/settings.(*Settings).Validate(_, {0x1, {0x4, 0x614c8660, {0xc00028c000, 0xb8, 0xb8}}, {0x1, 0x61f2977a, {0xc0001a6000, ...}}, ...})
        github.com/qdm12/gluetun/internal/configuration/settings/settings.go:50 +0x990
main._main({0xd2ad98, 0xc000494000}, {{0xd17408, 0x6}, {0xd176e8, 0x7}, {0xd19220, 0x18}}, {0xc00001e210, 0x1, ...}, ...)
        ./main.go:226 +0xca5
main.main.func1()
        ./main.go:87 +0x150
created by main.main
        ./main.go:86 +0x649

something went wrong with last commit? =)

Last working version for me docker pull qmcgaw/gluetun:v3.27.0

ghost commented 2 years ago

Same error after upgrading to version 3.28.0 from 3.27.0 Host: Ubuntu 20.04 Arch: amd64 Running with docker-compose

qdm12 commented 2 years ago

What a Sunday morning wake up! šŸ˜„

It looks like I have some CI tagging/pushing spaghetti mix-up, pr-848 is from https://github.com/qdm12/gluetun/pull/848

Anyway I manually pushed the latest image so it works again, and will fix up the build pipeline.

Let's leave this opened until I fix the build pipeline. Anyway I need to rework it to do another release tag like today šŸ‘

qdm12 commented 2 years ago

Build pipeline fixed! šŸ‘ You can also now use image :v3 which corresponds to the latest v3 release, if you prefer stability over the edge.

egadgetboy commented 7 months ago

Update (Resolution): Well, that's strange... but I updated my Compose from image: qmcgaw/gluetun:latest to image: qmcgaw/gluetun:v3.37.0 and the Gluetun container is healthy now

Why would this same issue from 2022 suddenly affect me? "panic: runtime error: invalid memory address or nil pointer dereference"

I've been running the latest version (v3.37.0) for several months and everything was fine. But it broke today. I tried removing the container and setting it up again, but the same error results.

Ubuntu Server 22.04.4 with latest updates/upgrades VPN: Proton Docker Compose

ritesh-kanchi commented 7 months ago

@egadgetboy Funny enough, ran into the same problem just now - thank you for recommending to use v3.37.0....don't know why we were getting those problems...

JackPo commented 7 months ago

Running into the same problem now also... wth?

JackPo commented 7 months ago

yea.. for some reason, what egadgetboy suggested works, updated compose with specific version and it worked.

cmorebutz commented 7 months ago

Ditto... latest update causes issue #855. Rollback to v3.37.0 fixed.

egadgetboy commented 7 months ago

Since v3.37.0 is the latest release, not sure if this is the issue (as in... which version is being pulled when using :latest) but I noticed that this page shows the latest version is an older version 3.35.0: https://github.com/qdm12/gluetun-wiki

steveb166 commented 7 months ago

Same issue occurred here, fixed with changing the tag to v3.37 in compose.

NewFangled1 commented 7 months ago

Ugh, had the same issue today. Due to the fact that I added another container to my docker-compose file, I assumed I had corrupted something that way. Now it seems more likely that it pulled the latest gluetun at the same time and caused the error. Specifying v3.37.0 fixed the issue.

captainkev76 commented 7 months ago

Same thing here. Thanks for the workaround. Must remember to switch back at some point in future :-)

qdm12 commented 7 months ago

To the many people who commented today, please note this issue is completely irrelevant to #2169 - it's just the panic: runtime error: invalid memory address or nil pointer dereference message which is the same, but this is a Go (programming language) builtin common error, when trying to access a nil pointer.