nic-6443 opened a new pull request, #13361:
URL: https://github.com/apache/apisix/pull/13361

   Several functions in `apisix/core/etcd.lua` access 
`res.body.header.revision` without checking whether `header` exists. When the 
response body lacks an etcd v3 `header` field — e.g. a reverse proxy returns 
its own JSON error, or the upstream returns a non-etcd response — this raises 
`attempt to index field 'header' (a nil value)`.
   
   Since `get_format` is called from `config_etcd.lua` during 
`init_worker_by_lua`, a malformed response during bootstrap crashes the worker 
init phase entirely (CrashLoopBackoff in K8s deployments).
   
   This PR adds a `get_header_revision()` helper that returns `nil, err` when 
`header` or `revision` is missing, and uses it in all 6 affected call sites in 
`etcd.lua`. It also guards the direct `res.body.header.revision` access in 
`config_etcd.lua`'s watch init retry loop to log and retry instead of crashing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to