ChuanFF commented on PR #12288:
URL: https://github.com/apache/apisix/pull/12288#issuecomment-2948378319

   There are two typos in the following code:  
   `informer.pre_List` should be `informer.pre_list`,  
   `informer.post_List` should be `informer.post_list`.
   
   
https://github.com/apache/apisix/blob/58066abc88df37a490f6c04011ed9588a0bda0d1/apisix/discovery/kubernetes/informer_factory.lua#L288-L303
   
   #### Function Behavior:
   - **`pre_list`** calls `shared_dict:flush_all()` 
([docs](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#ngxshareddictflush_all)),
 which expires all keys in the shared dictionary but doesn't physically delete 
them.
   - **`post_list`** calls `shared_dict:flush_expired()` 
([docs](https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#ngxshareddictflush_expired)),
 which physically deletes expired keys from the shared dictionary.
   
   #### Issue After Fixing Typos:
   When the typos are corrected, a new problem emerges:  
   `flush_all` function seems will kill 3 key-value pairs data in shared_dict 
([code 
reference](https://github.com/openresty/lua-nginx-module/blob/1f4d846f02cd3980d1f64fbc3e5359fd0e7716f6/src/ngx_http_lua_shdict.c#L1930)).
 This creates a critical window between the `pre_list` call and when new 
endpoints are populated. During this interval:
   1. some endpoint data in the shared dictionary will be missing
   2. requests may fail due to unavailable endpoint information
   
   Therefore, this typos bug seems not to be fixed directly. I'm not sure 
whether the behavior of flush all deleting some data is a bug
   


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to