Skip to content

Commit

Permalink
fix(sync): extend wait time for RPC layer initialization (#13939)
Browse files Browse the repository at this point in the history
When we start up DP, we need to make a meta call to CP first, so the first `do_sync` during the initial sync fails. It reports an ERR error: `rpc.lua:432: unable to create worker mutex and sync: rpc is not ready`. This experience is not ideal.

The initialization of the configuration also fails, and we have to wait for ourselves to wait 30 seconds (`sync_every(30s)`) before the configuration can sync successfully. This means that the DP will be unable to function for a period of time after connecting.

https://konghq.atlassian.net/browse/KAG-5922
  • Loading branch information
chobits authored Nov 29, 2024
1 parent e053601 commit a87e708
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kong/clustering/services/sync/rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ end

-- check if rpc connection is ready
local function is_rpc_ready()
for i = 1, 5 do
-- TODO: find a better way to detect when the RPC layer, including caps list,
-- has been fully initialized, instead of waiting for up to 5.5 seconds
for i = 1, 10 do
local res = kong.rpc:get_peers()

-- control_plane is ready
Expand Down

1 comment on commit a87e708

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:a87e7087646ae19c892101d4bfadaf62354500ff
Artifacts available https://github.com/Kong/kong/actions/runs/12079764267

Please sign in to comment.