spacewander opened a new issue, #7025:
URL: https://github.com/apache/apisix/issues/7025

   ### Current Behavior
   
   The `pb.option` method in lua-protobuf is set on the pb_State object, which 
is mapped from the proto object in APISIX. Therefore, setting the option will 
affect other routes which share the same proto.
   
   Setting the option globally won't affect grpc-transcode as each proto has 
its own pb_State.
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   The test case below shows it:
   ```
   === TEST 12: set routes(id: 2)
   --- ONLY
   --- config
       location /t {
           content_by_lua_block {
               local t = require("lib.test_admin").test
               local code, body = t('/apisix/admin/routes/1',
                   ngx.HTTP_PUT,
                   [[{
                       "methods": ["GET"],
                       "uri": "/grpc_plus2",
                       "plugins": {
                           "grpc-transcode": {
                               "proto_id": "1",
                               "service": "helloworld.Greeter",
                               "method": "Plus"
                           }
                       },
                       "upstream": {
                           "scheme": "grpc",
                           "type": "roundrobin",
                           "nodes": {
                               "127.0.0.1:50051": 1
                           }
                       }
                   }]]
               )
               local code, body = t('/apisix/admin/routes/2',
                   ngx.HTTP_PUT,
                   [[{
                       "methods": ["GET"],
                       "uri": "/grpc_plus",
                       "plugins": {
                           "grpc-transcode": {
                               "proto_id": "1",
                               "service": "helloworld.Greeter",
                               "method": "Plus",
                               "pb_option":["int64_as_string", "enum_as_name"]
                           }
                       },
                       "upstream": {
                           "scheme": "grpc",
                           "type": "roundrobin",
                           "nodes": {
                               "127.0.0.1:50051": 1
                           }
                       }
                   }]]
               )
   
               if code >= 300 then
                   ngx.status = code
               end
               ngx.say(body)
   
               local http = require "resty.http"
               local uri = "http://127.0.0.1:"; .. ngx.var.server_port .. 
"/grpc_plus?a=1&b=2251799813685260"
               local httpc = http.new()
               local res, err = httpc:request_uri(uri)
               ngx.say(res.body)
               local uri = "http://127.0.0.1:"; .. ngx.var.server_port .. 
"/grpc_plus2?a=1&b=2251799813685260"
               local httpc = http.new()
               local res, err = httpc:request_uri(uri)
               ngx.say(res.body)
           }
       }
   --- request
   GET /t
   --- response_body
   passed
   --- no_error_log
   [error]
   ```
   
   The route configurations of `/grpc_plus` & `/grpc_plus2` are different, but 
now they provide the same result because of the pollution.
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): 2.13.1
   - Operating system (run `uname -a`): Linux DESKTOP-2022Q8F-wsl 
4.19.128-microsoft-standard
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): nginx 
version: openresty/1.19.9.1
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


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