AlinsRan opened a new pull request, #13541:
URL: https://github.com/apache/apisix/pull/13541

   ### What this fixes
   
   nacos service discovery in the **stream** subsystem fails to start: 
`init_worker` raises `lua_shared_dict "nacos-stream" not configured`.
   
   ### Root cause
   
   `apisix/discovery/nacos/init.lua` selects its shared dict by subsystem:
   
   ```lua
   local dict_name = is_http and "nacos" or "nacos-stream"   -- line 36
   ...
   local dict = ngx.shared[dict_name]
   if not dict then
       error('lua_shared_dict "' .. dict_name .. '" not configured')  -- line 
284
   end
   ```
   
   `apisix/cli/ngx_tpl.lua` declares `lua_shared_dict nacos 10m;` in the http 
block, but `nacos-stream` is declared nowhere (it is not part of 
`discovery_shared_dicts`, which only auto-injects `kubernetes`). So nacos 
discovery works in http but errors in stream.
   
   ### Change
   
   Declare `lua_shared_dict nacos-stream 10m;` in the stream block, mirroring 
the unconditional `nacos` dict on the http side.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change (N/A)
   - [x] I have verified that the changes pass the existing tests
   


-- 
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