tzssangglass opened a new issue #55:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/55


   ### Issue description
   
   If using `stop-request` but not calling `setStatusCode` will trigger an 
exception will trigger an internal exception in APISIX.
   
   ### Environment
   
   * your apisix-java-plugin-runner version: master
   * apisix version: master
   
   ### Minimal test code / Steps to reproduce the issue
   
   1. java code
   
   ```java
   package org.apache.apisix.plugin.runner.filter;
   
   import org.apache.apisix.plugin.runner.HttpRequest;
   import org.apache.apisix.plugin.runner.HttpResponse;
   import org.springframework.stereotype.Component;
   import reactor.core.publisher.Mono;
   
   @Component
   public class TestFilter implements PluginFilter {
   
       @Override
       public String name() {
           return "TestFilter";
       }
   
       @Override
       public Mono<Void> filter(HttpRequest request, HttpResponse response, 
PluginFilterChain chain) {
           response.setHeader("para_test", "test");
           return chain.filter(request, response);
       }
   }
   ```
   
   2. apisix route
   
   ```shell
   $ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri":"/*",
       "plugins":{
           "ext-plugin-pre-req":{
               "conf":[
                   {
                       "name":"TestFilter",
                       "value":"bar"
                   }
               ]
           }
       },
       "upstream":{
           "nodes":{
               "httpbin.org:80":1
           },
           "type":"roundrobin"
       }
   }'
   
   ```
   
   3. access apisix
   
   ```shell
   $ curl -i 127.0.0.1:9080/get
   ```
   
   4.  the `error.log` of apisix
   
   ```
   2021/08/01 01:40:03 [error] 124925#124925: *152 failed to run 
balancer_by_lua*: /usr/local/apisix/apisix/balancer.lua:181: attempt to index 
local 'up_conf' (a nil value)
   stack traceback:
        /usr/local/apisix/apisix/balancer.lua:181: in function 'pick_server'
        /usr/local/apisix/apisix/balancer.lua:268: in function 'run'
        /usr/local/apisix/apisix/init.lua:710: in function 'http_balancer_phase'
        balancer_by_lua:2: in main chunk while connecting to upstream, client: 
127.0.0.1, server: _, request: "GET /get HTTP/1.1", host: "127.0.0.1:9080"
   ```
   


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