envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
24.95k stars 4.8k forks source link

Envoy only registers the admin port on server (re)boot #20618

Closed sulavvr closed 2 years ago

sulavvr commented 2 years ago

Title: Envoy setup as a systemd service doesn't seem to register the listeners, just registers the admin port.

Description: We seem to have an issue with Envoy not registering the listeners. We have envoy setup as a systemd service, and when the server starts/reboots, only the admin port is registered. The upstream is a Redis cluster.

[Unit]
Description=Envoy Proxy
Wants=network-online.target
Requires=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/bin/envoy -c /etc/envoy/config.yaml
Restart=on-failure
RestartSec=30s

[Install]
WantedBy=multi-user.target

Scanning the log, it seems fine overall.

$ sudo lsof -i -P -n | grep envoy
envoy      696            root   20u  IPv4  18878      0t0  TCP *:3000 (LISTEN)

Also, if I just restart the envoy service, it works fine.

$ sudo systemctl restart envoy.service
$ sudo lsof -i -P -n | grep envoy
envoy     6003            root   20u  IPv4  97088      0t0  TCP *:3000 (LISTEN)
envoy     6003            root   22u  IPv4  97101      0t0  TCP 127.0.0.1:6380 (LISTEN)
envoy     6003            root   23u  IPv4  97102      0t0  TCP 127.0.0.1:6380 (LISTEN)

I tried a different port as well, but that didn't do much. I've also noticed that if I change the cluster_refresh_rate to the default value of 5 seconds instead of the 3600 seconds, then it works fine. But keeping it a higher value made sense because it should rarely change. Are we missing anything here? Any help would be appreciated. Thank you.

zhangbo1882 commented 2 years ago

I think you can set log level to get more debug information to see what happens.

ExecStart=/usr/bin/envoy -c /etc/envoy/config.yaml --log-level trace

sulavvr commented 2 years ago

Ahh yes, thanks @zhangbo1882! I probably could've done just that. :facepalm: Seems like it can't connect to Redis just yet.

[2022-04-02 02:32:01.184][707][debug][connection] [source/common/network/connection_impl.cc:907] [C0] connecting to 127.0.0.1:6379
[2022-04-02 02:32:01.185][707][debug][connection] [source/common/network/connection_impl.cc:927] [C0] connection in progress
[2022-04-02 02:32:01.185][707][trace][connection] [source/common/network/connection_impl.cc:478] [C0] writing 29 bytes, end_stream false
[2022-04-02 02:32:01.185][707][trace][connection] [source/common/network/connection_impl.cc:478] [C0] writing 28 bytes, end_stream false
[2022-04-02 02:32:01.185][707][trace][connection] [source/common/network/connection_impl.cc:563] [C0] socket event: 3
[2022-04-02 02:32:01.185][707][trace][connection] [source/common/network/connection_impl.cc:672] [C0] write ready
[2022-04-02 02:32:01.185][707][debug][connection] [source/common/network/connection_impl.cc:693] [C0] delayed connect error: 111
[2022-04-02 02:32:01.185][707][debug][connection] [source/common/network/connection_impl.cc:250] [C0] closing socket: 0
[2022-04-02 02:32:01.185][707][trace][connection] [source/common/network/connection_impl.cc:418] [C0] raising connection event 0
[2022-04-02 02:32:01.185][707][trace][main] [source/common/event/dispatcher_impl.cc:228] item added to deferred deletion list (size=1)
[2022-04-02 02:32:01.185][707][trace][main] [source/common/event/dispatcher_impl.cc:112] clearing deferred deletion list (size=1)
[2022-04-02 02:32:06.179][707][debug][main] [source/server/server.cc:246] flushing stats
[2022-04-02 02:32:06.179][707][debug][main] [source/server/server.cc:256] Envoy is not fully initialized, skipping histogram merge and flushing stats
[2022-04-02 02:32:11.182][707][debug][main] [source/server/server.cc:246] flushing stats
[2022-04-02 02:32:11.182][707][debug][main] [source/server/server.cc:256] Envoy is not fully initialized, skipping histogram merge and flushing stats
[2022-04-02 02:32:16.275][707][debug][main] [source/server/server.cc:246] flushing stats
[2022-04-02 02:32:16.277][707][debug][main] [source/server/server.cc:256] Envoy is not fully initialized, skipping histogram merge and flushing stats
[2022-04-02 02:32:21.346][707][debug][main] [source/server/server.cc:246] flushing stats
[2022-04-02 02:32:21.350][707][debug][main] [source/server/server.cc:256] Envoy is not fully initialized, skipping histogram merge and flushing stats
[2022-04-02 02:32:26.321][707][debug][main] [source/server/server.cc:246] flushing stats
[2022-04-02 02:32:26.325][707][debug][main] [source/server/server.cc:256] Envoy is not fully initialized, skipping histogram merge and flushing stats