You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After changing kong configuration (services or routes) everything works fine. But after re-creating kong workers, they may start working with outdated configuration. Problems occur if the database wasn't available when workers were started.
I think it may be somehow related to this issue: #9090
Expected Behavior
Refresh cache on every configuration change. Then even if the DB is unavailable, new workers will be able to get the current settings.
Steps To Reproduce
Prepare:
Start new kong from docker-compose KONG_DATABASE=postgres docker compose --profile database up -d
ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
kong 1 0.0 0.2 383456 45132 ? Ss 14:30 0:00 nginx: master process /usr/local/openresty/nginx/sbin/nginx -p /var/run/kong -c nginx.conf
kong 1407 0.4 0.4 421232 78088 ? S 14:30 0:03 nginx: worker process
kong 1408 0.4 0.4 418124 72376 ? S 14:30 0:03 nginx: worker process
kill 1407 1408
ps aux
kong 1 0.0 0.2 383456 45132 ? Ss 14:30 0:00 nginx: master process /usr/local/openresty/nginx/sbin/nginx -p /var/run/kong -c nginx.conf
kong 1482 6.3 0.4 417080 70408 ? S 14:54 0:00 nginx: worker process
kong 1483 4.7 0.4 417144 70152 ? S 14:54 0:00 nginx: worker process
Now changes from step 2 will not work, but the old route/services is working
Trying new route curl -s localhost:8000/new-route
{
"message": "no Route matched with those values",
"request_id": "427d1166a8fcab2f445e6b03e8771758"
}
kong logs: 2025/03/19 15:07:43 [alert] 1482#0: *3505 [lua] init.lua:1152: rewrite(): unsafe request processing due to earlier initialization errors; this node must be restarted (failed to build the router: could not load routes: [postgres] temporary failure in name resolution)
And if the database becomes available, nothing changes before the worker is killed again
It seems that when kong starts, it saves the config from the database to the cache and never update it, and if the database is unavailable, new workers will get the stale cached config.
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Kong version (
$ kong version
)Kong 3.9.0
Current Behavior
After changing kong configuration (services or routes) everything works fine. But after re-creating kong workers, they may start working with outdated configuration. Problems occur if the database wasn't available when workers were started.
I think it may be somehow related to this issue: #9090
Expected Behavior
Refresh cache on every configuration change. Then even if the DB is unavailable, new workers will be able to get the current settings.
Steps To Reproduce
Prepare:
Start new kong from docker-compose
KONG_DATABASE=postgres docker compose --profile database up -d
Do some configuration (service + route)
For example, I have service:
and route:
docker-compose down
Reproducing:
It works, everything is fine:
curl localhost:8000/old-route
curl -s localhost:8000/old-route
curl -s localhost:8000/new-route
docker-compose stop db
Trying new route
curl -s localhost:8000/new-route
Trying old route
curl -s localhost:8000/old-route
kong logs:
2025/03/19 15:07:43 [alert] 1482#0: *3505 [lua] init.lua:1152: rewrite(): unsafe request processing due to earlier initialization errors; this node must be restarted (failed to build the router: could not load routes: [postgres] temporary failure in name resolution)
It seems that when kong starts, it saves the config from the database to the cache and never update it, and if the database is unavailable, new workers will get the stale cached config.
Anything else?
No response
The text was updated successfully, but these errors were encountered: