You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/21 12:02:20 UTC

[GitHub] [apisix] zlhgo opened a new issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

zlhgo opened a new issue #6184:
URL: https://github.com/apache/apisix/issues/6184


   ### Issue description
   
   Occasionally appear
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):  2.11.0
   - OS (cmd: `uname -a`): Linux stable-apisix-gateway-5956d8b7-gns25 4.19.91-24.1.al7.x86_64 #1 SMP Wed Jul 21 17:40:23 CST 2021 x86_64 x86_64 x86_64 GNU/Linux
   
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   nginx version: openresty/1.19.9.1
   built by gcc 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) 
   built with OpenSSL 1.1.1l  24 Aug 2021
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.20 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.10 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/pcre/
 lib -L/usr/local/openresty/openssl/lib -Wl,-rpath,/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl/lib' --with-pcre --with-compat --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-ipv6 --with-mail --with-mail_ssl_module --with-md5-asm --with-pcre-jit --with-sha1-asm --with-stream --with-stream_ssl_module --with-threads --with-stream --with-stream_ssl_preread_module
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API): 3.5
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`): 3.7.0
   
   
   ### Steps to reproduce
   
   Can't be reproduced
   
   ### Actual result
   
   #
   
   ### Error log
   
   balancer.lua:187: attempt to index local 'up_conf' (a nil value)
   stack traceback:
           /usr/local/apisix/apisix/balancer.lua:187: in function 'pick_server'
           /usr/local/apisix/apisix/balancer.lua:325: in function 'run'
           /usr/local/apisix/apisix/init.lua:739: in function 'http_balancer_phase'
           balancer_by_lua:2: in main chunk while connecting to upstream, client: 110.155.11.10, server: _, request: "POST /sa.php?project=****** HTTP/1.1", host: "******"
   
   ### Expected result
   
   _No response_


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022922914


   From your logs, you have a plugin `ky-traffic-control`, maybe imitating `traffic-control`, you need to know that `traffic-control` plugin would to rewriting `upstream_conf`.
   
   here: https://github.com/apache/apisix/blob/427e9269efe32836051bf280ea2af4a566730ae4/apisix/plugins/traffic-split.lua#L196
   
   Let's ignore the ip issue for a moment.
   
   Just from the information you have provided so far
   
   1. this error occurred during the balancer phase retry.
   2. This error is probably related to `*-traffic-control` modifying upstream_conf.
   
   From the information you've provided so far, I still can't reproduce it. As already mentioned above, I need to be able to reproduce this issue in order to troubleshoot this problem.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022942814


   
   
   
   > > 现在我已经关闭了我自定义的分流插件
   > 
   > Hi, can it be reproduced with a fresh APISIX? (without any additional code)
   > 
   > Maybe we can add more log when `up_conf` is accessed, like logging the `tostring(up_conf)` with the route id and upstream id.
   
   可以的,我可以from官方镜像重新打一个包。 但是保留下面这个插件可以吗。我需要在access_log里记录upstream_name
   ```
   local ngx = ngx
   local core = require("apisix.core")
   
   local schema = {
       type = "object",
       properties = {},
       required = {}
   }
   
   local metadata_schema = {
       type = "object",
       properties = {},
       required = {}
   }
   
   local plugin_name = "ky-ngx-vars"
   
   local _M = {
       version = 0.1,
       priority = 0,        -- TODO: add a type field, may be a good idea
       name = plugin_name,
       schema = schema
   }
   
   
   function _M.check_schema(conf, schema_type)
       if schema_type == core.schema.TYPE_METADATA then
           return core.schema.check(metadata_schema, conf)
       end
       return core.schema.check(schema, conf)
   end
   
   
   function _M.before_proxy(conf, ctx)
       ngx.var.route_name = ctx.matched_route.value.name
       ngx.var.upstream_name = ctx.matched_upstream.name
   
       core.log.debug("set $route_name=", ngx.var.route_name)
       core.log.debug("set $upstream_name=", ngx.var.upstream_name)
   end
   
   
   return _M
   
   ```


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1023797703


   > 我们截取了串站时的前后5万行日志,有57M,如果需要这份日志的话,可以提供一个上传地址我传上来。再次感谢。
   
   Can you upload it to some cloud drive, email me the link and password?


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1053857163


   经过20天的线上验证,该问题目前没有再出现过。下面说下解决方法、思路和自查是否同样的问题。
   
   1、解决方法。修改 `/usr/local/openresty/lualib/tablepool.lua` 文件,去掉内存复用相关的功能,每次申请新的内存。
   ```lua
   local newtab = require "table.new"
   
   
   local _M = newtab(0, 2)
   
   
   function _M.fetch(tag, narr, nrec)
       return newtab(narr, nrec)
   end
   
   
   function _M.release(tag, obj, noclear)
       -- nil
   end
   
   
   return _M
   
   -- vi: ft=lua ts=4 sw=4 et
   ```
   
   2、解决思路
   其实也是蒙的。因为看了apisix的代码感觉也没什么问题,从`access.log`日志里看就是串站了,所以怀疑可能是api_ctx的内存串了,但是我也不敢确定是这个问题。
   
   3、问题自查
   ```bash
   cat /usr/local/apisix/logs/access.log | grep pick_server | grep picked_server
   ```
   如果上面命令没有输出就是对的。思路就是执行 `pick_server` 的时候正常情况下 `api_ctx` 变量里是没有 `picked_server` 这个属性存在。
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1032135430


   @tzssangglass 你好,因为这个问题不是必现的,只有当量大的时候偶尔会出现这个问题。所以我也没有办法让它复现。下面是我的配置文件,再加上前面 ky-ngx-vars.py 插件就是我的全部改动了。
   
   config.yaml
   ```yaml
   apisix:
     node_listen: # This style support multiple ports
       - 80
     ssl:
       enable: true
       listen: # APISIX listening port in https.
         - 443
   
       ssl_protocols: "TLSv1 TLSv1.1 TLSv1.2 TLSv1.3"
   
     admin_key:
       - name: admin
         key: ****** # using fixed API token has security risk, please update it when you deploy to production environment
         role: admin
     admin_listen:
       ip: "0.0.0.0"
       port: 9180
     allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
       - 127.0.0.0/24              # If we don't set any IP list, then any IP access is allowed by default.
       - 172.16.0.0/16
     extra_lua_path: "/usr/local/apisix/extra/?.lua"
   
   nginx_config:                     # config for render the template to genarate nginx.conf
     error_log: "/home/logs/applog/error.log"
     error_log_level: "info"         # warn,error
     worker_rlimit_nofile: 20480     # the number of files a worker process can open, should be larger than worker_connections
     event:
       worker_connections: 10620
     http:
       access_log: "/dev/stdout"
       access_log_format: '$remote_addr - [$remote_addr] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id $host [$http_client_v] [$http_device_id] [$http_utm_source] [$http_platform_brand] [$scheme] [$route_name]'
       keepalive_timeout: 75s         # timeout during which a keep-alive client connection will stay open on the server side.
       client_header_timeout: 120s     # timeout for reading client request header, then 408 (Request Time-out) error is returned to the client
       client_body_timeout: 120s       # timeout for reading client request body, then 408 (Request Time-out) error is returned to the client
       send_timeout: 10s              # timeout for transmitting a response to the client.then the connection is closed
       underscores_in_headers: "on"   # default enables the use of underscores in client request header fields
       real_ip_header: "X-Real-IP"    # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
       real_ip_from:                  # http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
         - 127.0.0.1
         - 'unix:'
       #lua_shared_dicts:              # add custom shared cache to nginx.conf
       #  ipc_shared_dict: 100m        # custom shared cache, format: `cache-key: cache-size`
     envs:                          # allow to get a list of environment variables
       - CLUSTER
   
     main_configuration_snippet: |-
       # load_module /usr/local/openresty/nginx/modules/ngx_http_opentracing_module.so;
   
     http_configuration_snippet: |-
       tcp_nopush          on;
       tcp_nodelay         on;
   
       reset_timedout_connection on;
   
       keepalive_requests 100;
   
       client_body_temp_path           /tmp/client-body;
       fastcgi_temp_path               /tmp/fastcgi-temp;
       proxy_temp_path                 /tmp/proxy-temp;
   
       proxy_buffering                 off;
       proxy_buffer_size               32k;
       proxy_buffers                   8 32k;
   
       client_header_buffer_size       1k;
       large_client_header_buffers     4 8k;
       client_body_buffer_size         10m;
   
       types_hash_max_size             2048;
       server_names_hash_max_size      4096;
       server_names_hash_bucket_size   64;
   
       proxy_headers_hash_max_size     512;
       proxy_headers_hash_bucket_size  64;
   
       variables_hash_bucket_size      256;
   
       ignore_invalid_headers          on;
   
       gzip on;
       gzip_comp_level 1;
       gzip_http_version 1.1;
       gzip_min_length 256;
       gzip_types application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/javascript text/plain text/x-component;
       gzip_proxied any;
       gzip_vary on;
   
       # opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /usr/local/apisix/conf/opentracing.json;
       # opentracing on;
   
       # Reverse proxies can detect if a client provides a X-Request-ID header, and pass it on to the
       # If no such header is provided, it can provide a random value.
       map $http_x_request_id $req_id {
           default   $http_x_request_id;
           ""        $request_id;
       }
   
       log_format log_json escape=json '{"timestamp": "$time_local",'
           '"rmt_addr": "$remote_addr",'
           '"rmt_user": "$remote_user",'
           '"x_forwarded": "$http_x_forwarded_for",'
           '"ret_code": "$status",'
           '"req_meth": "$request_method",'
           '"req_host": "$host",'
           '"req_uri": "$request_uri",'
           '"req_body": "$request_body",'
           '"req_time": "$request_time",'
           '"res_time": "$upstream_response_time",'
           '"upstream_status": "$upstream_status",'
           '"upstream_addr": "$upstream_addr"'
           '}';
     http_server_configuration_snippet: |
       http2_max_field_size            4k;
       http2_max_header_size           16k;
       http2_max_requests              1000;
       http2_max_concurrent_streams    128;
     http_server_location_configuration_snippet: |-
       if ($host ~* (\.int\.|\.pub\.)) {
           # 生产环境不允许访问 int pub 实例
           return 403 'deny';
       }
       set $route_name                  -;
       set $upstream_name               -;
   
       proxy_set_header X-Request-ID $req_id;
       add_header X-Request-ID $req_id;
   
       client_max_body_size             200m;
       # opentracing_propagate_context;
     http_admin_configuration_snippet: |-
       access_log /home/logs/projectLog/admin.log log_json;
     lua_shared_dict:
       prometheus-metrics: 100m
   
   etcd:
     host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
       - "http://172.16.78.1:2379"     # multiple etcd address, if your etcd cluster enables TLS, please use https scheme,
       - "http://172.16.78.2:2379"
       - "http://172.16.78.3:2379"
     prefix: /apisix/${{CLUSTER}}                 # apisix configurations prefix  ${{CLUSTER}} = prod-1
     timeout: 30                     # 30 seconds
     
   plugins:                          # plugin list (sorted by priority)
     - real-ip                        # priority: 23000
     - client-control                 # priority: 22000
     # - ext-plugin-pre-req             # priority: 12000
     - request-id                     # priority: 11010
     - fault-injection                # priority: 11000
     - serverless-pre-function        # priority: 10000
     - batch-requests                 # priority: 4010
     - cors                           # priority: 4000
     - ip-restriction                 # priority: 3000
     - ua-restriction                 # priority: 2999
     - referer-restriction            # priority: 2990
     - uri-blocker                    # priority: 2900
     # - request-validation             # priority: 2800
     # - openid-connect                 # priority: 2599
     # - authz-casbin                   # priority: 2560
     # - wolf-rbac                      # priority: 2555
     # - hmac-auth                      # priority: 2530
     - basic-auth                     # priority: 2520
     # - jwt-auth                       # priority: 2510
     # - key-auth                       # priority: 2500
     - consumer-restriction           # priority: 2400
     # - authz-keycloak                 # priority: 2000
     #- error-log-logger              # priority: 1091
     - proxy-mirror                   # priority: 1010
     - proxy-cache                    # priority: 1009
     - proxy-rewrite                  # priority: 1008
     - api-breaker                    # priority: 1005
     - limit-conn                     # priority: 1003
     - limit-count                    # priority: 1002
     - limit-req                      # priority: 1001
     #- node-status                   # priority: 1000
     - gzip                           # priority: 995
     - server-info                    # priority: 990
     - traffic-split                  # priority: 966
     - redirect                       # priority: 900
     # - response-rewrite               # priority: 899
     #- dubbo-proxy                   # priority: 507
     # - grpc-transcode                 # priority: 506
     - prometheus                     # priority: 500
     - echo                           # priority: 412
     # - http-logger                    # priority: 410
     # - sls-logger                     # priority: 406
     # - tcp-logger                     # priority: 405
     # - kafka-logger                   # priority: 403
     # - syslog                         # priority: 401
     # - udp-logger                     # priority: 400
     #- log-rotate                    # priority: 100
     # <- recommend to use priority (0, 100) for your custom plugins
     #- skywalking                    # priority: -1100
     - serverless-post-function       # priority: -2000
     # - ext-plugin-post-req            # priority: -3000
     # - ky-traffic-control
     - ky-ngx-vars
   
   stream_plugins: # sorted by priority
     - ip-restriction                 # priority: 3000
     - limit-conn                     # priority: 1003
     - mqtt-proxy                     # priority: 1000
     # <- recommend to use priority (0, 100) for your custom plugins
   
   plugin_attr:
     log-rotate:
       interval: 3600    # rotate interval (unit: second)
       max_kept: 168     # max number of log files will be kept
       enable_compression: false    # enable log file compression(gzip) or not, default false
     prometheus:
       export_uri: /apisix/prometheus/metrics
       enable_export_server: true
       export_addr:
         ip: 0.0.0.0
         port: 9091
     server-info:
       report_interval: 60  # server info report interval (unit: second)
       report_ttl: 3600     # live time for server info in etcd (unit: second)
     dubbo-proxy:
       upstream_multiplex_count: 32
     request-id:
       snowflake:
         enable: false
         snowflake_epoc: 1609459200000   # the starting timestamp is expressed in milliseconds
         data_machine_bits: 12           # data machine bit, maximum 31, because Lua cannot do bit operations greater than 31
         sequence_bits: 10               # each machine generates a maximum of (1 << sequence_bits) serial numbers per millisecond
         data_machine_ttl: 30            # live time for data_machine in etcd (unit: second)
         data_machine_interval: 10       # lease renewal interval in etcd (unit: second)
     ky-traffic-control:
       ab:
         server_url: http://ab-service-online.ky-ab.svc.cluster.local:8080
         timeout: 3
   ```
   
   nginx.conf
   ```
   master_process on;
   
   worker_processes auto;
   worker_cpu_affinity auto;
   
   # main configuration snippet starts
   # load_module /usr/local/openresty/nginx/modules/ngx_http_opentracing_module.so;
   # main configuration snippet ends
   
   error_log /home/logs/applog/error.log info;
   pid logs/nginx.pid;
   
   worker_rlimit_nofile 20480;
   
   events {
       accept_mutex off;
       worker_connections 10620;
   }
   
   worker_rlimit_core  16G;
   
   worker_shutdown_timeout 240s;
   
   env APISIX_PROFILE;
   env PATH; # for searching external plugin runner's binary
   
   env CLUSTER;
   
   
   http {
       # put extra_lua_path in front of the builtin path
       # so user can override the source code
       lua_package_path  "/usr/local/apisix/extra/?.lua;$prefix/deps/share/lua/5.1/?.lua;$prefix/deps/share/lua/5.1/?/init.lua;/usr/local/apisix/?.lua;/usr/local/apisix/?/init.lua;;/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua;";
       lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;$prefix/deps/lib/lua/5.1/?.so;;/usr/local/openresty/site/lualib/?.so;/usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;";
   
       lua_max_pending_timers 16384;
       lua_max_running_timers 4096;
   
       lua_shared_dict internal-status 10m;
       lua_shared_dict plugin-limit-req 10m;
       lua_shared_dict plugin-limit-count 10m;
       lua_shared_dict prometheus-metrics 100m;
       lua_shared_dict plugin-limit-conn 10m;
       lua_shared_dict upstream-healthcheck 10m;
       lua_shared_dict worker-events 10m;
       lua_shared_dict lrucache-lock 10m;
       lua_shared_dict balancer-ewma 10m;
       lua_shared_dict balancer-ewma-locks 10m;
       lua_shared_dict balancer-ewma-last-touched-at 10m;
       lua_shared_dict plugin-limit-count-redis-cluster-slot-lock 1m;
       lua_shared_dict tracing_buffer 10m; # plugin: skywalking
       lua_shared_dict plugin-api-breaker 10m;
       lua_shared_dict etcd-cluster-health-check 10m; # etcd health check
   
       # for openid-connect and authz-keycloak plugin
       lua_shared_dict discovery 1m; # cache for discovery metadata documents
   
       # for openid-connect plugin
       lua_shared_dict jwks 1m; # cache for JWKs
       lua_shared_dict introspection 10m; # cache for JWT verification results
   
       # for authz-keycloak
       lua_shared_dict access-tokens 1m; # cache for service account access tokens
   
       # for custom shared dict
   
       # for proxy cache
       proxy_cache_path /tmp/disk_cache_one levels=1:2 keys_zone=disk_cache_one:50m inactive=1d max_size=1G use_temp_path=off;
   
       # for proxy cache
       map $upstream_cache_zone $upstream_cache_zone_info {
           disk_cache_one /tmp/disk_cache_one,1:2;
       }
   
   
       lua_ssl_verify_depth 5;
       ssl_session_timeout 86400;
   
       underscores_in_headers on;
   
       lua_socket_log_errors off;
   
       resolver 169.254.20.10;
       resolver_timeout 5;
   
       lua_http10_buffering off;
   
       lua_regex_match_limit 100000;
       lua_regex_cache_max_entries 8192;
   
       log_format main escape=default '$remote_addr - [$remote_addr] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id $host [$http_client_v] [$http_device_id] [$http_utm_source] [$http_platform_brand] [$scheme] [$route_name]';
       uninitialized_variable_warn off;
   
   
       access_log /dev/stdout main buffer=16384 flush=3;
       open_file_cache  max=1000 inactive=60;
       client_max_body_size 0;
       keepalive_timeout 75s;
       client_header_timeout 120s;
       client_body_timeout 120s;
       send_timeout 10s;
       variables_hash_max_size 2048;
   
       server_tokens off;
   
       include mime.types;
       charset utf-8;
   
       # error_page
       error_page 500 @50x.html;
   
       real_ip_header X-Real-IP;
   
       real_ip_recursive off;
   
       set_real_ip_from 127.0.0.1;
       set_real_ip_from unix:;
   
   
       # http configuration snippet starts
       tcp_nopush          on;
       tcp_nodelay         on;
   
       reset_timedout_connection on;
   
       keepalive_requests 100;
   
       client_body_temp_path           /tmp/client-body;
       fastcgi_temp_path               /tmp/fastcgi-temp;
       proxy_temp_path                 /tmp/proxy-temp;
   
       proxy_buffering                 off;
       proxy_buffer_size               32k;
       proxy_buffers                   8 32k;
   
       client_header_buffer_size       1k;
       large_client_header_buffers     4 8k;
       client_body_buffer_size         10m;
   
       types_hash_max_size             2048;
       server_names_hash_max_size      4096;
       server_names_hash_bucket_size   64;
   
       proxy_headers_hash_max_size     512;
       proxy_headers_hash_bucket_size  64;
   
       variables_hash_bucket_size      256;
   
       ignore_invalid_headers          on;
   
       gzip on;
       gzip_comp_level 1;
       gzip_http_version 1.1;
       gzip_min_length 256;
       gzip_types application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/javascript text/plain text/x-component;
       gzip_proxied any;
       gzip_vary on;
   
       # opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /usr/local/apisix/conf/opentracing.json;
       # opentracing on;
   
       map $http_x_request_id $req_id {
           default   $http_x_request_id;
           ""        $request_id;
       }
   
       log_format log_json escape=json '{"timestamp": "$time_local",'
           '"rmt_addr": "$remote_addr",'
           '"rmt_user": "$remote_user",'
           '"x_forwarded": "$http_x_forwarded_for",'
           '"ret_code": "$status",'
           '"req_meth": "$request_method",'
           '"req_host": "$host",'
           '"req_uri": "$request_uri",'
           '"req_body": "$request_body",'
           '"req_time": "$request_time",'
           '"res_time": "$upstream_response_time",'
           '"upstream_status": "$upstream_status",'
           '"upstream_addr": "$upstream_addr"'
           '}';
       # http configuration snippet ends
   
       upstream apisix_backend {
           server 0.0.0.1;
   
           balancer_by_lua_block {
               apisix.http_balancer_phase()
           }
   
           keepalive 320;
           keepalive_requests 1000;
           keepalive_timeout 60s;
       }
   
   
       init_by_lua_block {
           require "resty.core"
           apisix = require("apisix")
   
           local dns_resolver = { "169.254.20.10", }
           local args = {
               dns_resolver = dns_resolver,
           }
           apisix.http_init(args)
       }
   
       init_worker_by_lua_block {
           apisix.http_init_worker()
       }
   
       exit_worker_by_lua_block {
           apisix.http_exit_worker()
       }
   
       server {
           listen 127.0.0.1:9090;
   
           access_log off;
   
           location / {
               content_by_lua_block {
                   apisix.http_control()
               }
           }
   
           location @50x.html {
               set $from_error_page 'true';
               content_by_lua_block {
                   require("apisix.error_handling").handle_500()
               }
           }
       }
   
       server {
           listen 0.0.0.0:9091;
   
           access_log off;
   
           location / {
               content_by_lua_block {
                   local prometheus = require("apisix.plugins.prometheus")
                   prometheus.export_metrics()
               }
           }
   
           location = /apisix/nginx_status {
               allow 127.0.0.0/24;
               deny all;
               stub_status;
           }
       }
   
       server {
           listen 0.0.0.0:9180;
           log_not_found off;
   
           # admin configuration snippet starts
           access_log /home/logs/projectLog/admin.log log_json;
           # admin configuration snippet ends
   
           set $upstream_scheme             'http';
           set $upstream_host               $http_host;
           set $upstream_uri                '';
   
           location /apisix/admin {
                   allow 127.0.0.0/24;
                   allow 172.16.0.0/16;
                   deny all;
   
               content_by_lua_block {
                   apisix.http_admin()
               }
           }
   
           location @50x.html {
               set $from_error_page 'true';
               content_by_lua_block {
                   require("apisix.error_handling").handle_500()
               }
           }
       }
   
       server {
           listen 0.0.0.0:80 default_server reuseport;
           listen [::]:80 default_server reuseport;
           listen 0.0.0.0:443 ssl default_server http2 reuseport;
           listen [::]:443 ssl default_server http2 reuseport;
   
           server_name _;
   
           ssl_certificate      cert/ssl_PLACE_HOLDER.crt;
           ssl_certificate_key  cert/ssl_PLACE_HOLDER.key;
           ssl_session_cache    shared:SSL:20m;
           ssl_session_timeout 10m;
   
           ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
           ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
           ssl_prefer_server_ciphers on;
           ssl_session_tickets off;
   
           # http server configuration snippet starts
           http2_max_field_size            4k;
           http2_max_header_size           16k;
           http2_max_requests              1000;
           http2_max_concurrent_streams    128;
           # http server configuration snippet ends
   
           location = /apisix/nginx_status {
               allow 127.0.0.0/24;
               deny all;
               access_log off;
               stub_status;
           }
   
   
           ssl_certificate_by_lua_block {
               apisix.http_ssl_phase()
           }
   
           proxy_ssl_name $upstream_host;
           proxy_ssl_server_name on;
   
           location / {
               set $upstream_mirror_host        '';
               set $upstream_upgrade            '';
               set $upstream_connection         '';
   
               set $upstream_scheme             'http';
               set $upstream_host               $http_host;
               set $upstream_uri                '';
               set $ctx_ref                     '';
               set $from_error_page             '';
   
               # http server location configuration snippet starts
               if ($host ~* (\.int\.|\.pub\.)) {
                   # 生产环境不允许访问 int pub 实例
                   return 403 'deny';
               }
               set $route_name                  -;
               set $upstream_name               -;
   
               proxy_set_header X-Request-ID $req_id;
               add_header X-Request-ID $req_id;
   
               client_max_body_size             200m;
               # opentracing_propagate_context;
               # http server location configuration snippet ends
   
   
               access_by_lua_block {
                   apisix.http_access_phase()
               }
   
               proxy_http_version 1.1;
               proxy_set_header   Host              $upstream_host;
               proxy_set_header   Upgrade           $upstream_upgrade;
               proxy_set_header   Connection        $upstream_connection;
               proxy_set_header   X-Real-IP         $remote_addr;
               proxy_pass_header  Date;
   
               ### the following x-forwarded-* headers is to send to upstream server
   
               set $var_x_forwarded_for        $remote_addr;
               set $var_x_forwarded_proto      $scheme;
               set $var_x_forwarded_host       $host;
               set $var_x_forwarded_port       $server_port;
   
               if ($http_x_forwarded_for != "") {
                   set $var_x_forwarded_for "${http_x_forwarded_for}, ${realip_remote_addr}";
               }
               if ($http_x_forwarded_host != "") {
                   set $var_x_forwarded_host $http_x_forwarded_host;
               }
               if ($http_x_forwarded_port != "") {
                   set $var_x_forwarded_port $http_x_forwarded_port;
               }
   
               proxy_set_header   X-Forwarded-For      $var_x_forwarded_for;
               proxy_set_header   X-Forwarded-Proto    $var_x_forwarded_proto;
               proxy_set_header   X-Forwarded-Host     $var_x_forwarded_host;
               proxy_set_header   X-Forwarded-Port     $var_x_forwarded_port;
   
               ###  the following configuration is to cache response content from upstream server
   
               set $upstream_cache_zone            off;
               set $upstream_cache_key             '';
               set $upstream_cache_bypass          '';
               set $upstream_no_cache              '';
   
               proxy_cache                         $upstream_cache_zone;
               proxy_cache_valid                   any 10s;
               proxy_cache_min_uses                1;
               proxy_cache_methods                 GET HEAD POST;
               proxy_cache_lock_timeout            5s;
               proxy_cache_use_stale               off;
               proxy_cache_key                     $upstream_cache_key;
               proxy_no_cache                      $upstream_no_cache;
               proxy_cache_bypass                  $upstream_cache_bypass;
   
   
               proxy_pass      $upstream_scheme://apisix_backend$upstream_uri;
   
               mirror          /proxy_mirror;
   
               header_filter_by_lua_block {
                   apisix.http_header_filter_phase()
               }
   
               body_filter_by_lua_block {
                   apisix.http_body_filter_phase()
               }
   
               log_by_lua_block {
                   apisix.http_log_phase()
               }
           }
   
           location @grpc_pass {
   
               access_by_lua_block {
                   apisix.grpc_access_phase()
               }
   
               grpc_set_header   Content-Type application/grpc;
               grpc_socket_keepalive on;
               grpc_pass         $upstream_scheme://apisix_backend;
   
               header_filter_by_lua_block {
                   apisix.http_header_filter_phase()
               }
   
               body_filter_by_lua_block {
                   apisix.http_body_filter_phase()
               }
   
               log_by_lua_block {
                   apisix.http_log_phase()
               }
           }
   
   
           location = /proxy_mirror {
               internal;
   
               if ($upstream_mirror_host = "") {
                   return 200;
               }
   
               proxy_http_version 1.1;
               proxy_set_header Host $upstream_host;
               proxy_pass $upstream_mirror_host$request_uri;
           }
   
           location @50x.html {
               set $from_error_page 'true';
               content_by_lua_block {
                   require("apisix.error_handling").handle_500()
               }
               header_filter_by_lua_block {
                   apisix.http_header_filter_phase()
               }
   
               log_by_lua_block {
                   apisix.http_log_phase()
               }
           }
       }
       # http end configuration snippet starts
   
   
       # http end configuration snippet ends
   }
   ```


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022910062


   请求到错误后端的日志
   ```
   2022/01/27 04:11:31 [info] 36#36: *144572 [lua] init.lua:554: fetch_ctx(): fetch ngx ctx: 1 while reading response header from upstream, client: 223.116.236.28, server: _, request: "POST /VideoMusic/GetInfo HTTP/2.0", upstream: "http://172.16.89.222:80/VideoMusic/GetInfo", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: true, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:488: compare_param(): pcre pat: \/((.|\n)*), client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:398: http_access_phase(): matched route: {"prev_plugin_config_ver":328217,"orig_plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_default","split_type":"distinct_id","enable":false},"header":{"enable":true},"upstreams":[{"instance_name":"stable","id":"f1011655","cluster":"prod-1","name":"ky-api_api_80","service_name":"api"},{"instance_name":"pub","id":"d9fb48ed","cluster":"prod-1","name":"ky-api_api-pub_80","service_name":"api-pub"}]}},"update_count":1,"createdIndex":210632,"key":"\/apisix\/prod-1\/routes\/33cddaff","clean_handlers":{},"has_domain":false,"orig_modifiedIndex":328206,"modifiedIndex":"328206#1","value":{"update_time":1643244706,"upstream_id":"f1011655","status":1,"create_time":1642132143,"uris":["\/*"],"plugin_config_id":"6eef47a8","id":"33cddaff","plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_ky123","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"labels":{
 "managed-by":"apisix-ingress-controller"},"desc":"Created by apisix-ingress-controller, DO NOT modify it manually","priority":0,"name":"ky-api_api-95_default","hosts":["api.ky.cn"]}}, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:305: get_upstream_by_id(): parsed upstream: {"key":"\/apisix\/prod-1\/upstreams\/f1011655","clean_handlers":{},"has_domain":false,"modifiedIndex":328216,"createdIndex":210630,"value":{"update_time":1643244706,"scheme":"http","labels":{"managed-by":"apisix-ingress-controller"},"create_time":1642132143,"id":"f1011655","type":"roundrobin","original_nodes":"table: 0x7f61c83ed930","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","nodes":"table: 0x7f61c83ed930","timeout":{"connect":5,"read":20,"send":10},"pass_host":"pass","hash_on":"vars","parent":{"key":"\/apisix\/prod-1\/upstreams\/f1011655","clean_handlers":"table: 0x7f61b05a2ac0","has_domain":false,"modifiedIndex":328216,"createdIndex":210630,"value":"table: 0x7f61c83ed7b8"},"name":"ky-api_api_80","nodes_ref":[{"weight":100,"port":80,"priority":0,"host":"172.16.87.109"},{"weight":100,"port":80,"priority":0,"host":"172.16.87.181"},{"weight":100,"port":8
 0,"priority":0,"host":"172.16.87.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.112"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.159"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.167"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.182"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.192"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.212"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.33"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.147"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.184"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.200"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.216"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.222"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.236"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.245"},{"weight":100,"port":80,"priority":0,"host":
 "172.16.89.6"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.117"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.124"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.139"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.142"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.150"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.166"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.184"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.21"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.234"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.45"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.88"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.95"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.97"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.120"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.122"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.138"},{"weight":1
 00,"port":80,"priority":0,"host":"172.16.91.145"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.153"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.19"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.75"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.78"}]}}, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] balancer.lua:183: pick_server(): route: {"prev_plugin_config_ver":328217,"orig_plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_default","split_type":"distinct_id","enable":false},"header":{"enable":true},"upstreams":[{"instance_name":"stable","id":"f1011655","cluster":"prod-1","name":"ky-api_api_80","service_name":"api"},{"instance_name":"pub","id":"d9fb48ed","cluster":"prod-1","name":"ky-api_api-pub_80","service_name":"api-pub"}]}},"update_count":1,"createdIndex":210632,"key":"\/apisix\/prod-1\/routes\/33cddaff","clean_handlers":{},"has_domain":false,"orig_modifiedIndex":328206,"modifiedIndex":"328206#1","value":{"update_time":1643244706,"upstream_id":"f1011655","status":1,"create_time":1642132143,"uris":["\/*"],"plugin_config_id":"6eef47a8","id":"33cddaff","plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_ky123","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"labels":{"managed-b
 y":"apisix-ingress-controller"},"desc":"Created by apisix-ingress-controller, DO NOT modify it manually","priority":0,"name":"ky-api_api-95_default","hosts":["api.ky.cn"]}}, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] balancer.lua:184: pick_server(): ctx: {"conf_type":"route","conf_version":"328206#1","conf_id":"33cddaff","route_id":"33cddaff","route_name":"ky-api_api-95_default","balancer_try_count":1,"global_rules":{"need_reload":false,"values":[{"key":"\/apisix\/prod-1\/global_rules\/1","clean_handlers":{},"modifiedIndex":1715,"createdIndex":1152,"value":{"create_time":1639554601,"id":"1","plugins":{"prometheus":{"disable":false,"prefer_name":true},"ky-ngx-vars":{"disable":false}},"update_time":1639562234}}],"etcd_cli":{"is_auth":false,"ssl_verify":true,"is_cluster":true,"endpoints":[{"full_prefix":"http:\/\/172.16.78.232:2379\/v3","scheme":"http","host":"172.16.78.232","port":"2379","http_host":"http:\/\/172.16.78.232:2379","api_prefix":"\/v3"},{"full_prefix":"http:\/\/172.16.78.233:2379\/v3","scheme":"http","host":"172.16.78.233","port":"2379","http_host":"http:\/\/172.16.78.233:2379","api_prefix":"\/v3"},{"full_prefix":"http:\/\/172.16.78.23
 4:2379\/v3","scheme":"http","host":"172.16.78.234","port":"2379","http_host":"http:\/\/172.16.78.234:2379","api_prefix":"\/v3"}],"serializer":{"deserialize":"function: 0x7f61c902b6b0","serialize":"function: 0x7f61c902b6f0"},"timeout":30,"key_prefix":"","sema":{"sem":"cdata<struct ngx_http_lua_sema_s *>: 0x7f61c840c028"},"last_auth_time":1643255881.774,"ttl":-1},"values_hash":{"1":1},"running":true,"key":"\/apisix\/prod-1\/global_rules","item_schema":{"properties":{"create_time":{"type":"integer"},"id":{"anyOf":[{"minLength":1,"type":"string","pattern":"^[a-zA-Z0-9-_.]+$","maxLength":64},{"type":"integer","minimum":1}]},"plugins":{"type":"object"},"update_time":"table: 0x7f61c8607f40"},"type":"object","required":["plugins"]},"health_check_timeout":10,"prev_index":329699,"resync_delay":5,"checker":"function: 0x7f61c85d8fa8","automatic":true,"conf_version":3,"sync_times":0,"last_err_time":1643256642},"matched_upstream":{"update_time":1643244706,"scheme":"http","labels":{"managed-by":"a
 pisix-ingress-controller"},"create_time":1642132143,"id":"f1011655","type":"roundrobin","original_nodes":"table: 0x7f61c83ed930","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","nodes":"table: 0x7f61c83ed930","timeout":{"connect":5,"read":20,"send":10},"pass_host":"pass","hash_on":"vars","parent":{"key":"\/apisix\/prod-1\/upstreams\/f1011655","clean_handlers":{},"has_domain":false,"modifiedIndex":328216,"createdIndex":210630,"value":"table: 0x7f61c83ed7b8"},"name":"ky-api_api_80","nodes_ref":[{"weight":100,"port":80,"priority":0,"host":"172.16.87.109"},{"weight":100,"port":80,"priority":0,"host":"172.16.87.181"},{"weight":100,"port":80,"priority":0,"host":"172.16.87.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.112"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.159"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.167"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.182"},{"weight":100,"port":80,"priority":0,"host":"17
 2.16.88.192"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.212"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.33"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.147"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.184"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.200"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.216"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.222"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.236"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.245"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.6"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.117"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.124"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.139"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.142"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.150"},{"weight":
 100,"port":80,"priority":0,"host":"172.16.90.166"},{"weight":100,"port":80,"priority":0,"host":"172
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:538: http_access_phase(): stash ngx ctx: 6, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] balancer.lua:349: run(): proxy request to 172.16.91.123:8080 while connecting to upstream, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:554: fetch_ctx(): fetch ngx ctx: 6 while reading response header from upstream, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", upstream: "http://172.16.91.123:8080/VideoMusic/AppInit", host: "api.ky.cn"
   ```
   
   `proxy request to 172.16.91.123:8080` 这里的IP端口并没有在上面的upstream里面。
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022833791


   昨天已经把大部分流量切回了 `kubernetes/ingress-nginx`, 今天早上还是出现了几次 `/usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)` 同时也有路由请求到了错误的后端地址。
   
   告警日志
   ```
   At least 3 events occurred between 2022-01-27 10:23 CST and 2022-01-27 10:28 CST
   
   instance.keyword:
   stable: 5
   inner: 1
   
   message.keyword:
   2022/01/27 02:28:18 [error] 34#34: 27527237 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:20 [error] 34#34: 27531572 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:22 [error] 36#36: 27408336 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:23 [error] 36#36: 27408064 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:23 [error] 36#36: 27408537 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   
   @timestamp: 2022-01-27T02:28:20.029Z
   _id: k2JcmX4BJEYEGnF4xPKm
   _index: ingress_apisix-gateway_app-log-2022.01.27
   _type: _doc
   instance: stable
   message: 2022/01/27 02:28:20 [error] 34#34: 27531572 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)
   num_hits: 6
   num_matches: 2
   ```
   
   
   阿里云sls查的最近1小时ingress access log日志。
   ```sql
   * | select proxy_upstream_name, min(time) as min_time, max(time) as max_time, count(*) as count where upstream_addr = '172.16.90.251:8080' and _container_name_='apisix-gateway' group by proxy_upstream_name
   ```
   
   查询结果
   | proxy\_upstream\_name                | min\_time            | max\_time            | count  |
   | ------------------------------------ | -------------------- | -------------------- | ------ |
   | sentry\_stable-sentry-relay\_3000    | 27/Jan/2022:02:28:21 | 27/Jan/2022:02:28:23 | 2      |
   | h5\_h5-api\_80               | 27/Jan/2022:02:28:19 | 27/Jan/2022:02:28:19 | 1      |
   | api\_adv-api-online\_8080 | 27/Jan/2022:02:27:03 | 27/Jan/2022:03:27:08 | 111394 |
   | bigdata\_sa-api-online\_80        | 27/Jan/2022:02:28:22 | 27/Jan/2022:02:28:22 | 1      |
   
   通过access log可以看到,同一个时间范围,的确有不同的路由请求打到了同一个后端 `upstream_addr = '172.16.90.251:8080'` 上。
   
   补充一个证据, stable-sentry-relay 这个服务已经80多天没有重启了。POD IP也没有 172.16.90.251 这个IP。
   ```
   → kubectl --context prod-1 -n sentry get pods -o wide | grep relay                                                                                                                                          
   stable-sentry-relay-56bf48f677-h5fqw                              1/1     Running     0          82d     172.16.87.161    cn-beijing.172.16.24.167   <none>           <none>
   stable-sentry-relay-56bf48f677-hzvtn                              1/1     Running     0          82d     172.16.108.163   cn-beijing.172.16.78.67    <none>           <none>
   ```
   
   现在我已经关闭了我自定义的分流插件,并且开启了info级别的日志,并重启了apisix-gateway。
   
   ----------------
   
   就刚准备提交这个回复之前,这个问题又出现了。请稍等我提交error_log日志。
   
   @leslie-tsang @tzssangglass @starsz 请各位大佬帮忙关注下。谢谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022939813


   > 现在我已经关闭了我自定义的分流插件
   
   Hi, can it be reproduced with a fresh APISIX? (without any additional code)
   
   Maybe we can add more log when `up_conf` is accessed, like logging the `tostring(up_conf)` with the route id and upstream id.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1031241820


   I didn't find anything of value, but I found something strange.
   
   the route `"\/apisix\/prod-1\/routes\/dc0b6538"` match uris is
   
   ```
              "\/api\/store*",
               "\/api\/1*",
               "\/api\/2*",
               "\/api\/3*",
               "\/api\/4*",
               "\/api\/5*",
               "\/api\/6*",
               "\/api\/7*",
               "\/api\/8*",
               "\/api\/9*"
   ```
   
   and the request `POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0` would match `\/api\/1*`? 
   
   
   I don't know the details inside, just that it seems incorrect based on the naming.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1019405890


   It's very hard to reproduce.This is my production environment and cannot open info level logs.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022925843


   @tzssangglass 你好。
   ky-traffic-control 这个插件我已经在中午12点以前已经禁用了,所以应该和我的插件没有关系吧?
   这段日志是12点以后的。我通过日志分析发现可能请求了错误的后端和`attempt to index local 'up_conf' (a nil value)`应该没有直接的关系。 因为我发现日志里记录的请求了错误的后端早于`attempt to index local 'up_conf' (a nil value)`之前发生。谢谢。
   
   请稍等我提供 `attempt to index local 'up_conf' (a nil value)` 相关的日志。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022105505


   今天下午遇到一个更奇怪的问题。16:25到16:45出现了 423 此 `/usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)`。同时伴随着一部分路由的请求转发了到一个错误的后端地址上。造成了业务报错才发现是请求了错误的后端地址。16:45后这个问题就自动恢复了。这段时候我也没有做什么操作,查了apisix-admin的日志 ingress-controller 也没有更新过upstream。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022925843


   @tzssangglass 你好。
   ~~ky-traffic-control 这个插件我已经在中午12点以前已经禁用了,所以应该和我的插件没有关系吧?
   这段日志是12点以后的。我通过日志分析发现可能请求了错误的后端和`attempt to index local 'up_conf' (a nil value)`应该没有直接的关系。 因为我发现日志里记录的请求了错误的后端早于`attempt to index local 'up_conf' (a nil value)`之前发生。谢谢。~~
   
   请稍等我提供 `attempt to index local 'up_conf' (a nil value)` 相关的日志。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1031260859


   @tzssangglass 你好。因为 /api/0 是转发到 sentry-web 这个服务的,  其它所有 /api\/store* 和 /api/\d+ 都是转发到 sentry-relay 这个服务,因为我自己做了一个简单的配置页面,只支持了前缀匹配,所以就有了这个奇怪的配置。我在群里给你私聊了,方便上QQ沟通下吗,谢谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1032195425


   I tried it locally and still couldn't reproduce it.
   
   All I know now is that the error occurred when the balancer retry lost the `route` and `ctx`, and I still don't know how this happened.
   
   I see you have `extra_lua_path`, did your private code modify the balancer phase?


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] leslie-tsang commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1021825746


   Hello there, I'm afraid we can't do anything due to the lack of necessary information at the moment.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1021110184


   @starsz Yes, but my plugin has not modified the `ctx.upstream_conf`


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022922914


   ~From your logs, you have a plugin `ky-traffic-control`, maybe imitating `traffic-split`, you need to know that `traffic-split` plugin would to rewriting `upstream_conf`.~
   
   here: https://github.com/apache/apisix/blob/427e9269efe32836051bf280ea2af4a566730ae4/apisix/plugins/traffic-split.lua#L196
   
   Let's ignore the ip issue for a moment.
   
   Just from the information you have provided so far
   
   1. this error occurred during the balancer phase retry.
   ~2. This error is probably related to `*-traffic-control` modifying upstream_conf.~
   
   From the information you've provided so far, I still can't reproduce it. As already mentioned above, I need to be able to reproduce this issue in order to troubleshoot this problem.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1023042859


   > ngx.var.route_name = ctx.matched_route.value.name
   >     ngx.var.upstream_name = ctx.matched_upstream.name
   
   BTW, we support register custom variable by another way, see: https://github.com/apache/apisix/blob/master/docs/en/latest/plugin-develop.md#register-custom-variable


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1053857163


   经过20天的线上验证,该问题目前没有再出现过。下面说下解决方法、思路和自查是否同样的问题。
   
   1、解决方法
   修改 `/usr/local/openresty/lualib/tablepool.lua` 文件,去掉内存复用相关的功能,每次申请新的内存。
   ```lua
   local newtab = require "table.new"
   
   
   local _M = newtab(0, 2)
   
   
   function _M.fetch(tag, narr, nrec)
       return newtab(narr, nrec)
   end
   
   
   function _M.release(tag, obj, noclear)
       -- nil
   end
   
   
   return _M
   
   -- vi: ft=lua ts=4 sw=4 et
   ```
   
   2、解决思路
   其实也是蒙的。因为看了apisix的代码感觉也没什么问题,从`access.log`日志里看就是串站了,所以怀疑可能是api_ctx的内存串了,但是我也不敢确定是这个问题。
   
   3、问题自查
   ```bash
   cat /usr/local/apisix/logs/error.log | grep pick_server | grep picked_server
   ```
   如果上面命令没有输出就是对的(需开启info级别的error log)。思路就是执行 `pick_server` 的时候正常情况下 `api_ctx` 变量里是没有 `picked_server` 这个属性存在。
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1021110184


   @starsz Yes, but my plugin has not modified the `ctx.upstream_conf`


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022105505


   今天下午遇到一个更奇怪的问题。16:25到16:45出现了 423 次 `/usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)`。同时伴随着一部分路由的请求转发了到一个错误的后端地址上。造成了业务报错才发现是请求了错误的后端地址。16:45后这个问题就自动恢复了。这段时候我也没有做什么操作,查了apisix-admin的日志 ingress-controller 也没有更新过upstream。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022925843


   @tzssangglass 你好。
   ky-traffic-control 这个插件我已经在中午12点以前已经禁用了,所以应该和我的插件没有关系吧?
   这段日志是12点以后的。我通过日志分析发现可能请求了错误的后端和`attempt to index local 'up_conf' (a nil value)`应该没有直接的关系。 因为我发现日志里记录的请求了错误的后端早于`attempt to index local 'up_conf' (a nil value)`之前发生。谢谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1063561807


   > I can reproduce this issue with a different setup; will make an issue detailing it
   
   See your new issue, we'll talk about it in a new issue.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1032119775


   > @tzssangglass 你好。因为 /api/0 是转发到 sentry-web 这个服务的, 其它所有 /api/store* 和 /api/\d+ 都是转发到 sentry-relay 这个服务,因为我自己做了一个简单的配置页面,只支持了前缀匹配,所以就有了这个奇怪的配置。我在群里给你私聊了,方便上QQ沟通下吗,谢谢。
   
   Can you provide more reproduction of the configuration and private code here? I'd like to reproduce this locally. Otherwise we won't get anywhere productive with our communication.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1031004846


   @tzssangglass 你好,请问下有没有发现什么问题呢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1053857163


   经过20天的线上验证,该问题目前没有再出现过。下面说下解决方法、思路和自查是否同样的问题。
   
   1、解决方法
   修改 `/usr/local/openresty/lualib/tablepool.lua` 文件,去掉内存复用相关的功能,每次申请新的内存。
   ```lua
   local newtab = require "table.new"
   
   
   local _M = newtab(0, 2)
   
   
   function _M.fetch(tag, narr, nrec)
       return newtab(narr, nrec)
   end
   
   
   function _M.release(tag, obj, noclear)
       -- nil
   end
   
   
   return _M
   
   -- vi: ft=lua ts=4 sw=4 et
   ```
   
   2、解决思路
   其实也是蒙的。因为看了apisix的代码感觉也没什么问题,从`access.log`日志里看就是串站了,所以怀疑可能是api_ctx的内存串了,但是我也不敢确定是这个问题。
   
   3、问题自查
   ```bash
   cat /usr/local/apisix/logs/access.log | grep pick_server | grep picked_server
   ```
   如果上面命令没有输出就是对的。思路就是执行 `pick_server` 的时候正常情况下 `api_ctx` 变量里是没有 `picked_server` 这个属性存在。
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1021822206


   不好意思各位,我还是用中文吧。
   这个是我的生产环境,25号大概5000多万次请求, `/usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)` 也只出现了7次,有时候会多些,估计也就1、20次的样子。不太好复现。@tzssangglass
   
   @starsz 因为是生产环境我的插件可能不方便禁用。
   谢谢两位。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022922914


   From your logs, you have a plugin `ky-traffic-control`, maybe imitating `traffic-control`, you need to know that `traffic-control` plugin is rewriting `upstream_conf`.
   
   here: https://github.com/apache/apisix/blob/427e9269efe32836051bf280ea2af4a566730ae4/apisix/plugins/traffic-split.lua#L196
   
   Let's ignore the ip issue for a moment.
   
   Just from the information you have provided so far
   
   1. this error occurred during the balancer phase retry.
   2. This error is probably related to `*-traffic-control` modifying upstream_conf.
   
   From the information you've provided so far, I still can't reproduce it. As already mentioned above, I need to be able to reproduce this issue in order to troubleshoot this problem.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1023261042


   @tzssangglass 谢谢,自定义变量我后面换成官方推荐的方式。
   
   @spacewander @starsz @leslie-tsang 
   apisix 升级到了 2.12.0后, 同样有串站的问题(就是请求到了别的服务的后端地址上)和`attempt to index local 'up_conf' (a nil value)`的问题。日志就和上面提到的一样。同时发现这两个问题是同一时间发生的,并且error_log里两个是穿插打印在一起的。
   我们截取了串站时的前后5万行日志,有57M,如果需要这份日志的话,可以提供一个上传地址我传上来。再次感谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022833791


   昨天已经把大部分流量切回了 `kubernetes/ingress-nginx`, 今天早上还是出现了几次 `/usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)` 同时也有路由请求到了错误的后端地址。
   
   告警日志
   ```
   At least 3 events occurred between 2022-01-27 10:23 CST and 2022-01-27 10:28 CST
   
   instance.keyword:
   stable: 5
   inner: 1
   
   message.keyword:
   2022/01/27 02:28:18 [error] 34#34: 27527237 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:20 [error] 34#34: 27531572 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:22 [error] 36#36: 27408336 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:23 [error] 36#36: 27408064 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   2022/01/27 02:28:23 [error] 36#36: 27408537 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value): 1
   
   @timestamp: 2022-01-27T02:28:20.029Z
   _id: k2JcmX4BJEYEGnF4xPKm
   _index: ingress_apisix-gateway_app-log-2022.01.27
   _type: _doc
   instance: stable
   message: 2022/01/27 02:28:20 [error] 34#34: 27531572 failed to run balancer_by_lua: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)
   num_hits: 6
   num_matches: 2
   ```
   
   
   阿里云sls查的最近1小时ingress access log日志。
   ```sql
   * | select proxy_upstream_name, min(time) as min_time, max(time) as max_time, count(*) as count where upstream_addr = '172.16.90.251:8080' and _container_name_='apisix-gateway' group by proxy_upstream_name
   ```
   
   查询结果
   | proxy\_upstream\_name                | min\_time            | max\_time            | count  |
   | ------------------------------------ | -------------------- | -------------------- | ------ |
   | sentry\_stable-sentry-relay\_3000    | 27/Jan/2022:02:28:21 | 27/Jan/2022:02:28:23 | 2      |
   | h5\_h5-api\_80               | 27/Jan/2022:02:28:19 | 27/Jan/2022:02:28:19 | 1      |
   | api\_adv-api-online\_8080 | 27/Jan/2022:02:27:03 | 27/Jan/2022:03:27:08 | 111394 |
   | bigdata\_sa-api-online\_80        | 27/Jan/2022:02:28:22 | 27/Jan/2022:02:28:22 | 1      |
   
   通过access log可以看到,同一个时间范围,的确有不同的路由请求打到了同一个后端 `upstream_addr = '172.16.90.251:8080'` 上。
   
   
   现在我已经关闭了我自定义的分流插件,并且开启了info级别的日志,并重启了apisix-gateway。
   
   ----------------
   
   就刚准备提交这个回复之前,这个问题又出现了。请稍等我提交error_log日志。
   
   @leslie-tsang @tzssangglass @starsz 请各位大佬帮忙关注下。谢谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1031260859


   @tzssangglass 你好。因为 /api/0 是转发到 sentry-web 这个服务的,  其它所有 /api/\d+ 都是转发到 sentry-relay 这个服务,因为我自己做了一个简单的配置页面,只支持了前缀匹配,所以就有了这个奇怪的配置。我在群里给你私聊了,方便上QQ沟通下吗,谢谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1031260859


   @tzssangglass 你好。因为 /api/0 是转发到 sentry-web 这个服务的,  其它所有 /api/store* 和 /api/\d+ 都是转发到 sentry-relay 这个服务,因为我自己做了一个简单的配置页面,只支持了前缀匹配,所以就有了这个奇怪的配置。我在群里给你私聊了,方便上QQ沟通下吗,谢谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] starsz commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
starsz commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1021764140


   > @starsz Yes, but my plugin has not modified the `ctx.upstream_conf`
   
   Maybe you can disable your plugins, and have a try.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1023261042


   @tzssangglass 谢谢,自定义变量我后面换成官方推荐的方式。
   
   @spacewander @starsz @leslie-tsang 
   apisix 升级到了 2.12.0后, 同样有串站的问题(就是请求到了别的服务的后端地址上)和`attempt to index local 'up_conf' (a nil value)`的问题。日志就和上面提到的一样。同时发现这两个问题是同一时间发生的,并且error_log里两个是穿插打印在一起的。
   我们截取了串站是的前后5万行日志,有57M,如果需要这份日志的话,可以提供一个上传地址我传上来。再次感谢。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1023019300


   @spacewander @starsz @tzssangglass @leslie-tsang 各位大佬好。
   我已经基于 apache/apisix:2.12.0-centos 重新打包了。并只保留了上面的 `ky-ngx-vars` 插件。以下是我打包运行相关代码。
   
   Dockerfile
   ```dockerfile
   FROM apache/apisix:2.12.0-centos
   
   # COPY conf/opentracing.json.tpl /usr/local/apisix/conf/opentracing.json
   COPY plugins/ky-ngx-vars.lua /usr/local/apisix/extra/apisix/plugins/ky-ngx-vars.lua
   COPY run.sh /usr/local/apisix/run.sh
   
   ENTRYPOINT ["sh", "/usr/local/apisix/run.sh"]
   ```
   
   run.sh
   ```bash
   #!/bin/bash
   
   mkdir -p /home/logs/applog/
   mkdir -p /home/logs/projectLog/
   mkdir -p /usr/local/apisix/logs
   
   cd /usr/local/apisix/
   
   # JAEGER_SAMPLER_PARAM=${JAEGER_SAMPLER_PARAM:-0.1}
   # sed -i -e "s/#JAEGER_SAMPLER_PARAM/$JAEGER_SAMPLER_PARAM/g" /usr/local/apisix/conf/opentracing.json
   # sed -i -e "s/#JAEGER_HOST/$JAEGER_HOST/g" /usr/local/apisix/conf/opentracing.json
   
   # /usr/bin/apisix init
   /usr/bin/apisix init_etcd
   
   exec /usr/local/openresty/bin/openresty -p /usr/local/apisix -g 'daemon off;'
   ```
   
   我先观察几天看看。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo closed issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo closed issue #6184:
URL: https://github.com/apache/apisix/issues/6184


   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1021730898


   reproducible steps are needed to be able to track issues.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022941369


   attempt to index local 'up_conf' (a nil value) 相关错误日志。
   
   ```
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] radixtree.lua:564: match_route_opts(): hosts match: true, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] radixtree.lua:488: compare_param(): pcre pat: \/api\/1*, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] init.lua:398: http_access_phase(): matched route: {"prev_plugin_config_ver":328214,"orig_plugins":{"ky-traffic-control":{"ab":{"key":"monitoring_sentry_relay","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"update_count":1,"createdIndex":1669,"key":"\/apisix\/prod-1\/routes\/dc0b6538","clean_handlers":{},"has_domain":false,"orig_modifiedIndex":328215,"modifiedIndex":"328215#1","value":{"update_time":1643244706,"upstream_id":"733aa9ed","status":1,"create_time":1639561609,"uris":["\/api\/store*","\/api\/1*","\/api\/2*","\/api\/3*","\/api\/4*","\/api\/5*","\/api\/6*","\/api\/7*","\/api\/8*","\/api\/9*"],"plugin_config_id":"a45e88d1","id":"dc0b6538","plugins":{"ky-traffic-control":{"ab":{"key":"monitoring_sentry_relay","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"labels":{"managed-by":"apisix-ingress-controller"},"desc":"Created by apisix-ingress-controller,
  DO NOT modify it manually","priority":0,"name":"sentry_sentry-14_relay","hosts":["sentry.ky.cn"]}}, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] init.lua:305: get_upstream_by_id(): parsed upstream: {"key":"\/apisix\/prod-1\/upstreams\/733aa9ed","clean_handlers":{},"has_domain":false,"modifiedIndex":328241,"createdIndex":1668,"value":{"labels":{"managed-by":"apisix-ingress-controller"},"nodes_ref":[{"weight":100,"priority":0,"port":3000,"host":"172.16.108.163"},{"weight":100,"priority":0,"port":3000,"host":"172.16.87.161"}],"nodes":"table: 0x7f61c85fac88","create_time":1639561609,"update_time":1643244709,"type":"roundrobin","original_nodes":"table: 0x7f61c85fac88","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","id":"733aa9ed","pass_host":"pass","timeout":{"connect":5,"read":20,"send":20},"hash_on":"vars","parent":{"key":"\/apisix\/prod-1\/upstreams\/733aa9ed","clean_handlers":"table: 0x7f61b0807b50","has_domain":false,"modifiedIndex":328241,"createdIndex":1668,"value":"table: 0x7f61c85fabb8"},"name":"sentry_stable-sentry-relay_3000","scheme":"http"}},
  client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] balancer.lua:183: pick_server(): route: {"prev_plugin_config_ver":328214,"orig_plugins":{"ky-traffic-control":{"ab":{"key":"monitoring_sentry_relay","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"update_count":1,"createdIndex":1669,"key":"\/apisix\/prod-1\/routes\/dc0b6538","clean_handlers":{},"has_domain":false,"orig_modifiedIndex":328215,"modifiedIndex":"328215#1","value":{"update_time":1643244706,"upstream_id":"733aa9ed","status":1,"create_time":1639561609,"uris":["\/api\/store*","\/api\/1*","\/api\/2*","\/api\/3*","\/api\/4*","\/api\/5*","\/api\/6*","\/api\/7*","\/api\/8*","\/api\/9*"],"plugin_config_id":"a45e88d1","id":"dc0b6538","plugins":{"ky-traffic-control":{"ab":{"key":"monitoring_sentry_relay","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"labels":{"managed-by":"apisix-ingress-controller"},"desc":"Created by apisix-ingress-controller, DO NOT mo
 dify it manually","priority":0,"name":"sentry_sentry-14_relay","hosts":["sentry.ky.cn"]}}, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] balancer.lua:184: pick_server(): ctx: {"global_rules":{"need_reload":false,"values":[{"key":"\/apisix\/prod-1\/global_rules\/1","clean_handlers":{},"modifiedIndex":1715,"createdIndex":1152,"value":{"create_time":1639554601,"id":"1","plugins":{"prometheus":{"disable":false,"prefer_name":true},"ky-ngx-vars":{"disable":false}},"update_time":1639562234}}],"etcd_cli":{"is_auth":false,"ssl_verify":true,"is_cluster":true,"endpoints":[{"full_prefix":"http:\/\/172.16.78.232:2379\/v3","scheme":"http","host":"172.16.78.232","port":"2379","http_host":"http:\/\/172.16.78.232:2379","api_prefix":"\/v3"},{"full_prefix":"http:\/\/172.16.78.233:2379\/v3","scheme":"http","host":"172.16.78.233","port":"2379","http_host":"http:\/\/172.16.78.233:2379","api_prefix":"\/v3"},{"full_prefix":"http:\/\/172.16.78.234:2379\/v3","scheme":"http","host":"172.16.78.234","port":"2379","http_host":"http:\/\/172.16.78.234:2379","api_prefix":"\/v3"}],"serializer":{"deser
 ialize":"function: 0x7f61c902b6b0","serialize":"function: 0x7f61c902b6f0"},"timeout":30,"key_prefix":"","sema":{"sem":"cdata<struct ngx_http_lua_sema_s *>: 0x7f61c840c028"},"last_auth_time":1643255881.774,"ttl":-1},"values_hash":{"1":1},"running":true,"key":"\/apisix\/prod-1\/global_rules","item_schema":{"properties":{"create_time":{"type":"integer"},"id":{"anyOf":[{"minLength":1,"type":"string","pattern":"^[a-zA-Z0-9-_.]+$","maxLength":64},{"type":"integer","minimum":1}]},"plugins":{"type":"object"},"update_time":"table: 0x7f61c8607f40"},"type":"object","required":["plugins"]},"health_check_timeout":10,"prev_index":329699,"resync_delay":5,"checker":"function: 0x7f61c85d8fa8","automatic":true,"conf_version":3,"sync_times":0,"last_err_time":1643256642},"matched_upstream":"table: 0x7f61c85fabb8","conf_type":"route","matched_route":{"prev_plugin_config_ver":328214,"orig_plugins":{"ky-traffic-control":{"ab":{"key":"monitoring_sentry_relay","split_type":"distinct_id","enable":false},"hea
 der":{"enable":false},"upstreams":{}}},"update_count":1,"createdIndex":1669,"key":"\/apisix\/prod-1\/routes\/dc0b6538","clean_handlers":{},"has_domain":false,"orig_modifiedIndex":328215,"modifiedIndex":"328215#1","value":{"update_time":1643244706,"upstream_id":"733aa9ed","status":1,"create_time":1639561609,"uris":["\/api\/store*","\/api\/1*","\/api\/2*","\/api\/3*","\/api\/4*","\/api\/5*","\/api\/6*","\/api\/7*","\/api\/8*","\/api\/9*"],"plugin_config_id":"a45e88d1","id":"dc0b6538","plugins":{"ky-traffic-control":{"ab":{"key":"monitoring_sentry_relay","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"labels":{"managed-by":"apisix-ingress-controller"},"desc":"Created by apisix-ingress-controller, DO NOT modify it manually","priority":0,"name":"sentry_sentry-14_relay","hosts":["sentry.ky.cn"]}},"conf_version":"328215#1","upstream_key":"roundrobin#upstream_table: 0x7f61c85fabb8","conf_id":"dc0b6538","var":{"_cache":{"request_method":"POST","remote_a
 ddr":"117.136.86.244","uri":"\/api\/14\/store\/","host":"sentry.ky.cn","upstream_scheme":"http","real_request_uri":"\/api\/14\/store\/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7","request_uri":"\/api\/14\/store\/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7"},"_request":"cdata<void *>: 0x55d77d857400"},"route_id":"dc0b6538","route_name":"sentry_sentry-14_relay","upstream_conf":{"labels":{"managed-by":"apisix-ingress-controller"},"nodes_ref":[{"weight":100,"priority":0,"port":3000,"host":"172.16.108.163"},{"weight":100,"priority":0,"port":3000,"host":"172.16.87.161"}],"nodes":"table: 0x7f61c85fac88","create_time":1639561609,"update_time":1643244709,"type":"roundrobin","original_nodes":"table: 0x7f61c85fac88","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","id":"733aa9ed","pass_host":"pass","timeout":{"connect":5,"read":20,"send":20},"hash_on":"vars","parent":{"key":"\/apisix\/prod-1\/upstreams\/733aa9ed","clean_handlers":{},"
 has_domain":false,"modifiedIndex":328241,"createdIndex":1668,"value":"table: 0x7f61c85fabb8"},"na
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] init.lua:538: http_access_phase(): stash ngx ctx: 6, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] balancer.lua:183: pick_server(): route: null while connecting to upstream, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] balancer.lua:184: pick_server(): ctx: {} while connecting to upstream, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [error] 36#36: *144813 failed to run balancer_by_lua*: /usr/local/apisix/apisix/balancer.lua:187: attempt to index local 'up_conf' (a nil value)
   stack traceback:
           /usr/local/apisix/apisix/balancer.lua:187: in function 'pick_server'
           /usr/local/apisix/apisix/balancer.lua:325: in function 'run'
           /usr/local/apisix/apisix/init.lua:739: in function 'http_balancer_phase'
           balancer_by_lua:2: in main chunk while connecting to upstream, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   2022/01/27 04:11:34 [info] 36#36: *144813 [lua] init.lua:554: fetch_ctx(): fetch ngx ctx: 6 while sending to client, client: 117.136.86.244, server: _, request: "POST /api/14/store/?sentry_key=c95cef49d5e44f5c989f45f2b862f7fa&sentry_version=7 HTTP/2.0", host: "sentry.ky.cn", referrer: "https://h5.ky.cn/"
   ```


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo edited a comment on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo edited a comment on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1022910062


   请求到错误后端的日志
   ```
   2022/01/27 04:11:31 [info] 36#36: *144572 [lua] init.lua:554: fetch_ctx(): fetch ngx ctx: 1 while reading response header from upstream, client: 223.116.236.28, server: _, request: "POST /VideoMusic/GetInfo HTTP/2.0", upstream: "http://172.16.89.222:80/VideoMusic/GetInfo", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: false, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:564: match_route_opts(): hosts match: true, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] radixtree.lua:488: compare_param(): pcre pat: \/((.|\n)*), client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:398: http_access_phase(): matched route: {"prev_plugin_config_ver":328217,"orig_plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_default","split_type":"distinct_id","enable":false},"header":{"enable":true},"upstreams":[{"instance_name":"stable","id":"f1011655","cluster":"prod-1","name":"ky-api_api_80","service_name":"api"},{"instance_name":"pub","id":"d9fb48ed","cluster":"prod-1","name":"ky-api_api-pub_80","service_name":"api-pub"}]}},"update_count":1,"createdIndex":210632,"key":"\/apisix\/prod-1\/routes\/33cddaff","clean_handlers":{},"has_domain":false,"orig_modifiedIndex":328206,"modifiedIndex":"328206#1","value":{"update_time":1643244706,"upstream_id":"f1011655","status":1,"create_time":1642132143,"uris":["\/*"],"plugin_config_id":"6eef47a8","id":"33cddaff","plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_ky123","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"labels":{
 "managed-by":"apisix-ingress-controller"},"desc":"Created by apisix-ingress-controller, DO NOT modify it manually","priority":0,"name":"ky-api_api-95_default","hosts":["api.ky.cn"]}}, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:305: get_upstream_by_id(): parsed upstream: {"key":"\/apisix\/prod-1\/upstreams\/f1011655","clean_handlers":{},"has_domain":false,"modifiedIndex":328216,"createdIndex":210630,"value":{"update_time":1643244706,"scheme":"http","labels":{"managed-by":"apisix-ingress-controller"},"create_time":1642132143,"id":"f1011655","type":"roundrobin","original_nodes":"table: 0x7f61c83ed930","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","nodes":"table: 0x7f61c83ed930","timeout":{"connect":5,"read":20,"send":10},"pass_host":"pass","hash_on":"vars","parent":{"key":"\/apisix\/prod-1\/upstreams\/f1011655","clean_handlers":"table: 0x7f61b05a2ac0","has_domain":false,"modifiedIndex":328216,"createdIndex":210630,"value":"table: 0x7f61c83ed7b8"},"name":"ky-api_api_80","nodes_ref":[{"weight":100,"port":80,"priority":0,"host":"172.16.87.109"},{"weight":100,"port":80,"priority":0,"host":"172.16.87.181"},{"weight":100,"port":8
 0,"priority":0,"host":"172.16.87.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.112"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.159"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.167"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.182"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.192"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.212"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.33"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.147"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.184"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.200"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.216"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.222"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.236"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.245"},{"weight":100,"port":80,"priority":0,"host":
 "172.16.89.6"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.117"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.124"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.139"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.142"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.150"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.166"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.184"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.21"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.234"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.45"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.88"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.95"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.97"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.120"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.122"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.138"},{"weight":1
 00,"port":80,"priority":0,"host":"172.16.91.145"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.153"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.19"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.75"},{"weight":100,"port":80,"priority":0,"host":"172.16.91.78"}]}}, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] balancer.lua:183: pick_server(): route: {"prev_plugin_config_ver":328217,"orig_plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_default","split_type":"distinct_id","enable":false},"header":{"enable":true},"upstreams":[{"instance_name":"stable","id":"f1011655","cluster":"prod-1","name":"ky-api_api_80","service_name":"api"},{"instance_name":"pub","id":"d9fb48ed","cluster":"prod-1","name":"ky-api_api-pub_80","service_name":"api-pub"}]}},"update_count":1,"createdIndex":210632,"key":"\/apisix\/prod-1\/routes\/33cddaff","clean_handlers":{},"has_domain":false,"orig_modifiedIndex":328206,"modifiedIndex":"328206#1","value":{"update_time":1643244706,"upstream_id":"f1011655","status":1,"create_time":1642132143,"uris":["\/*"],"plugin_config_id":"6eef47a8","id":"33cddaff","plugins":{"ky-traffic-control":{"ab":{"key":"ky-api_api_ky123","split_type":"distinct_id","enable":false},"header":{"enable":false},"upstreams":{}}},"labels":{"managed-b
 y":"apisix-ingress-controller"},"desc":"Created by apisix-ingress-controller, DO NOT modify it manually","priority":0,"name":"ky-api_api-95_default","hosts":["api.ky.cn"]}}, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] balancer.lua:184: pick_server(): ctx: {"conf_type":"route","conf_version":"328206#1","conf_id":"33cddaff","route_id":"33cddaff","route_name":"ky-api_api-95_default","balancer_try_count":1,"global_rules":{"need_reload":false,"values":[{"key":"\/apisix\/prod-1\/global_rules\/1","clean_handlers":{},"modifiedIndex":1715,"createdIndex":1152,"value":{"create_time":1639554601,"id":"1","plugins":{"prometheus":{"disable":false,"prefer_name":true},"ky-ngx-vars":{"disable":false}},"update_time":1639562234}}],"etcd_cli":{"is_auth":false,"ssl_verify":true,"is_cluster":true,"endpoints":[{"full_prefix":"http:\/\/172.16.78.232:2379\/v3","scheme":"http","host":"172.16.78.232","port":"2379","http_host":"http:\/\/172.16.78.232:2379","api_prefix":"\/v3"},{"full_prefix":"http:\/\/172.16.78.233:2379\/v3","scheme":"http","host":"172.16.78.233","port":"2379","http_host":"http:\/\/172.16.78.233:2379","api_prefix":"\/v3"},{"full_prefix":"http:\/\/172.16.78.23
 4:2379\/v3","scheme":"http","host":"172.16.78.234","port":"2379","http_host":"http:\/\/172.16.78.234:2379","api_prefix":"\/v3"}],"serializer":{"deserialize":"function: 0x7f61c902b6b0","serialize":"function: 0x7f61c902b6f0"},"timeout":30,"key_prefix":"","sema":{"sem":"cdata<struct ngx_http_lua_sema_s *>: 0x7f61c840c028"},"last_auth_time":1643255881.774,"ttl":-1},"values_hash":{"1":1},"running":true,"key":"\/apisix\/prod-1\/global_rules","item_schema":{"properties":{"create_time":{"type":"integer"},"id":{"anyOf":[{"minLength":1,"type":"string","pattern":"^[a-zA-Z0-9-_.]+$","maxLength":64},{"type":"integer","minimum":1}]},"plugins":{"type":"object"},"update_time":"table: 0x7f61c8607f40"},"type":"object","required":["plugins"]},"health_check_timeout":10,"prev_index":329699,"resync_delay":5,"checker":"function: 0x7f61c85d8fa8","automatic":true,"conf_version":3,"sync_times":0,"last_err_time":1643256642},"matched_upstream":{"update_time":1643244706,"scheme":"http","labels":{"managed-by":"a
 pisix-ingress-controller"},"create_time":1642132143,"id":"f1011655","type":"roundrobin","original_nodes":"table: 0x7f61c83ed930","desc":"Created by apisix-ingress-controller, DO NOT modify it manually","nodes":"table: 0x7f61c83ed930","timeout":{"connect":5,"read":20,"send":10},"pass_host":"pass","hash_on":"vars","parent":{"key":"\/apisix\/prod-1\/upstreams\/f1011655","clean_handlers":{},"has_domain":false,"modifiedIndex":328216,"createdIndex":210630,"value":"table: 0x7f61c83ed7b8"},"name":"ky-api_api_80","nodes_ref":[{"weight":100,"port":80,"priority":0,"host":"172.16.87.109"},{"weight":100,"port":80,"priority":0,"host":"172.16.87.181"},{"weight":100,"port":80,"priority":0,"host":"172.16.87.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.112"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.159"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.167"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.182"},{"weight":100,"port":80,"priority":0,"host":"17
 2.16.88.192"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.212"},{"weight":100,"port":80,"priority":0,"host":"172.16.88.33"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.147"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.184"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.200"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.216"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.222"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.236"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.241"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.245"},{"weight":100,"port":80,"priority":0,"host":"172.16.89.6"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.117"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.124"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.139"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.142"},{"weight":100,"port":80,"priority":0,"host":"172.16.90.150"},{"weight":
 100,"port":80,"priority":0,"host":"172.16.90.166"},{"weight":100,"port":80,"priority":0,"host":"172
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:538: http_access_phase(): stash ngx ctx: 6, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] balancer.lua:349: run(): proxy request to 172.16.91.123:8080 while connecting to upstream, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", host: "api.ky.cn"
   2022/01/27 04:11:34 [info] 36#36: *144572 [lua] init.lua:554: fetch_ctx(): fetch ngx ctx: 6 while reading response header from upstream, client: 223.116.236.28, server: _, request: "POST /VideoMusic/AppInit HTTP/2.0", upstream: "http://172.16.91.123:8080/VideoMusic/AppInit", host: "api.ky.cn"
   ```
   
   `proxy request to 172.16.91.123:8080` 这里的IP端口并没有在上面的upstream里面。
   
   虽然route里还有我自定义插件的配置,但是我已经在 apisix config.yaml里注释掉了自定义插件,并重启了apisix-gateway,所以这个route plugins配置应该是不会影响的。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1023811916


   > > 我们截取了串站时的前后5万行日志,有57M,如果需要这份日志的话,可以提供一个上传地址我传上来。再次感谢。
   > 
   > Can you upload it to some cloud drive, email me the link and password?
   
   发你邮件了。


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1032135430


   @tzssangglass 你好,因为这个问题不是必现的,只有当量大的时候偶尔会出现这个问题。所以我也没有办法让它复现。下面是我的配置文件,再加上前面 ky-ngx-vars.py 插件就是我的全部改动了。
   
   config.yaml
   ```yaml
   apisix:
     node_listen: # This style support multiple ports
       - 80
     ssl:
       enable: true
       listen: # APISIX listening port in https.
         - 443
   
       ssl_protocols: "TLSv1 TLSv1.1 TLSv1.2 TLSv1.3"
   
     admin_key:
       - name: admin
         key: ****** # using fixed API token has security risk, please update it when you deploy to production environment
         role: admin
     admin_listen:
       ip: "0.0.0.0"
       port: 9180
     allow_admin: # http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
       - 127.0.0.0/24              # If we don't set any IP list, then any IP access is allowed by default.
       - 172.16.0.0/16
     extra_lua_path: "/usr/local/apisix/extra/?.lua"
   
   nginx_config:                     # config for render the template to genarate nginx.conf
     error_log: "/home/logs/applog/error.log"
     error_log_level: "info"         # warn,error
     worker_rlimit_nofile: 20480     # the number of files a worker process can open, should be larger than worker_connections
     event:
       worker_connections: 10620
     http:
       access_log: "/dev/stdout"
       access_log_format: '$remote_addr - [$remote_addr] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id $host [$http_client_v] [$http_device_id] [$http_utm_source] [$http_platform_brand] [$scheme] [$route_name]'
       keepalive_timeout: 75s         # timeout during which a keep-alive client connection will stay open on the server side.
       client_header_timeout: 120s     # timeout for reading client request header, then 408 (Request Time-out) error is returned to the client
       client_body_timeout: 120s       # timeout for reading client request body, then 408 (Request Time-out) error is returned to the client
       send_timeout: 10s              # timeout for transmitting a response to the client.then the connection is closed
       underscores_in_headers: "on"   # default enables the use of underscores in client request header fields
       real_ip_header: "X-Real-IP"    # http://nginx.org/en/docs/http/ngx_http_realip_module.html#real_ip_header
       real_ip_from:                  # http://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from
         - 127.0.0.1
         - 'unix:'
       #lua_shared_dicts:              # add custom shared cache to nginx.conf
       #  ipc_shared_dict: 100m        # custom shared cache, format: `cache-key: cache-size`
     envs:                          # allow to get a list of environment variables
       - CLUSTER
   
     main_configuration_snippet: |-
       # load_module /usr/local/openresty/nginx/modules/ngx_http_opentracing_module.so;
   
     http_configuration_snippet: |-
       tcp_nopush          on;
       tcp_nodelay         on;
   
       reset_timedout_connection on;
   
       keepalive_requests 100;
   
       client_body_temp_path           /tmp/client-body;
       fastcgi_temp_path               /tmp/fastcgi-temp;
       proxy_temp_path                 /tmp/proxy-temp;
   
       proxy_buffering                 off;
       proxy_buffer_size               32k;
       proxy_buffers                   8 32k;
   
       client_header_buffer_size       1k;
       large_client_header_buffers     4 8k;
       client_body_buffer_size         10m;
   
       types_hash_max_size             2048;
       server_names_hash_max_size      4096;
       server_names_hash_bucket_size   64;
   
       proxy_headers_hash_max_size     512;
       proxy_headers_hash_bucket_size  64;
   
       variables_hash_bucket_size      256;
   
       ignore_invalid_headers          on;
   
       gzip on;
       gzip_comp_level 1;
       gzip_http_version 1.1;
       gzip_min_length 256;
       gzip_types application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/javascript text/plain text/x-component;
       gzip_proxied any;
       gzip_vary on;
   
       # opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /usr/local/apisix/conf/opentracing.json;
       # opentracing on;
   
       # Reverse proxies can detect if a client provides a X-Request-ID header, and pass it on to the
       # If no such header is provided, it can provide a random value.
       map $http_x_request_id $req_id {
           default   $http_x_request_id;
           ""        $request_id;
       }
   
       log_format log_json escape=json '{"timestamp": "$time_local",'
           '"rmt_addr": "$remote_addr",'
           '"rmt_user": "$remote_user",'
           '"x_forwarded": "$http_x_forwarded_for",'
           '"ret_code": "$status",'
           '"req_meth": "$request_method",'
           '"req_host": "$host",'
           '"req_uri": "$request_uri",'
           '"req_body": "$request_body",'
           '"req_time": "$request_time",'
           '"res_time": "$upstream_response_time",'
           '"upstream_status": "$upstream_status",'
           '"upstream_addr": "$upstream_addr"'
           '}';
     http_server_configuration_snippet: |
       http2_max_field_size            4k;
       http2_max_header_size           16k;
       http2_max_requests              1000;
       http2_max_concurrent_streams    128;
     http_server_location_configuration_snippet: |-
       if ($host ~* (\.int\.|\.pub\.)) {
           # 生产环境不允许访问 int pub 实例
           return 403 'deny';
       }
       set $route_name                  -;
       set $upstream_name               -;
   
       proxy_set_header X-Request-ID $req_id;
       add_header X-Request-ID $req_id;
   
       client_max_body_size             200m;
       # opentracing_propagate_context;
     http_admin_configuration_snippet: |-
       access_log /home/logs/projectLog/admin.log log_json;
     lua_shared_dict:
       prometheus-metrics: 100m
   
   etcd:
     host:                           # it's possible to define multiple etcd hosts addresses of the same etcd cluster.
       - "http://172.16.78.1:2379"     # multiple etcd address, if your etcd cluster enables TLS, please use https scheme,
       - "http://172.16.78.2:2379"
       - "http://172.16.78.3:2379"
     prefix: /apisix/${{CLUSTER}}                 # apisix configurations prefix  ${{CLUSTER}} = prod-1
     timeout: 30                     # 30 seconds
     
   plugins:                          # plugin list (sorted by priority)
     - real-ip                        # priority: 23000
     - client-control                 # priority: 22000
     # - ext-plugin-pre-req             # priority: 12000
     - request-id                     # priority: 11010
     - fault-injection                # priority: 11000
     - serverless-pre-function        # priority: 10000
     - batch-requests                 # priority: 4010
     - cors                           # priority: 4000
     - ip-restriction                 # priority: 3000
     - ua-restriction                 # priority: 2999
     - referer-restriction            # priority: 2990
     - uri-blocker                    # priority: 2900
     # - request-validation             # priority: 2800
     # - openid-connect                 # priority: 2599
     # - authz-casbin                   # priority: 2560
     # - wolf-rbac                      # priority: 2555
     # - hmac-auth                      # priority: 2530
     - basic-auth                     # priority: 2520
     # - jwt-auth                       # priority: 2510
     # - key-auth                       # priority: 2500
     - consumer-restriction           # priority: 2400
     # - authz-keycloak                 # priority: 2000
     #- error-log-logger              # priority: 1091
     - proxy-mirror                   # priority: 1010
     - proxy-cache                    # priority: 1009
     - proxy-rewrite                  # priority: 1008
     - api-breaker                    # priority: 1005
     - limit-conn                     # priority: 1003
     - limit-count                    # priority: 1002
     - limit-req                      # priority: 1001
     #- node-status                   # priority: 1000
     - gzip                           # priority: 995
     - server-info                    # priority: 990
     - traffic-split                  # priority: 966
     - redirect                       # priority: 900
     # - response-rewrite               # priority: 899
     #- dubbo-proxy                   # priority: 507
     # - grpc-transcode                 # priority: 506
     - prometheus                     # priority: 500
     - echo                           # priority: 412
     # - http-logger                    # priority: 410
     # - sls-logger                     # priority: 406
     # - tcp-logger                     # priority: 405
     # - kafka-logger                   # priority: 403
     # - syslog                         # priority: 401
     # - udp-logger                     # priority: 400
     #- log-rotate                    # priority: 100
     # <- recommend to use priority (0, 100) for your custom plugins
     #- skywalking                    # priority: -1100
     - serverless-post-function       # priority: -2000
     # - ext-plugin-post-req            # priority: -3000
     # - ky-traffic-control
     - ky-ngx-vars
   
   stream_plugins: # sorted by priority
     - ip-restriction                 # priority: 3000
     - limit-conn                     # priority: 1003
     - mqtt-proxy                     # priority: 1000
     # <- recommend to use priority (0, 100) for your custom plugins
   
   plugin_attr:
     log-rotate:
       interval: 3600    # rotate interval (unit: second)
       max_kept: 168     # max number of log files will be kept
       enable_compression: false    # enable log file compression(gzip) or not, default false
     prometheus:
       export_uri: /apisix/prometheus/metrics
       enable_export_server: true
       export_addr:
         ip: 0.0.0.0
         port: 9091
     server-info:
       report_interval: 60  # server info report interval (unit: second)
       report_ttl: 3600     # live time for server info in etcd (unit: second)
     dubbo-proxy:
       upstream_multiplex_count: 32
     request-id:
       snowflake:
         enable: false
         snowflake_epoc: 1609459200000   # the starting timestamp is expressed in milliseconds
         data_machine_bits: 12           # data machine bit, maximum 31, because Lua cannot do bit operations greater than 31
         sequence_bits: 10               # each machine generates a maximum of (1 << sequence_bits) serial numbers per millisecond
         data_machine_ttl: 30            # live time for data_machine in etcd (unit: second)
         data_machine_interval: 10       # lease renewal interval in etcd (unit: second)
     ky-traffic-control:
       ab:
         server_url: http://ab-service-online.ky-ab.svc.cluster.local:8080
         timeout: 3
   ```
   
   ```
   master_process on;
   
   worker_processes auto;
   worker_cpu_affinity auto;
   
   # main configuration snippet starts
   # load_module /usr/local/openresty/nginx/modules/ngx_http_opentracing_module.so;
   # main configuration snippet ends
   
   error_log /home/logs/applog/error.log info;
   pid logs/nginx.pid;
   
   worker_rlimit_nofile 20480;
   
   events {
       accept_mutex off;
       worker_connections 10620;
   }
   
   worker_rlimit_core  16G;
   
   worker_shutdown_timeout 240s;
   
   env APISIX_PROFILE;
   env PATH; # for searching external plugin runner's binary
   
   env CLUSTER;
   
   
   http {
       # put extra_lua_path in front of the builtin path
       # so user can override the source code
       lua_package_path  "/usr/local/apisix/extra/?.lua;$prefix/deps/share/lua/5.1/?.lua;$prefix/deps/share/lua/5.1/?/init.lua;/usr/local/apisix/?.lua;/usr/local/apisix/?/init.lua;;/usr/local/openresty/site/lualib/?.ljbc;/usr/local/openresty/site/lualib/?/init.ljbc;/usr/local/openresty/lualib/?.ljbc;/usr/local/openresty/lualib/?/init.ljbc;/usr/local/openresty/site/lualib/?.lua;/usr/local/openresty/site/lualib/?/init.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/?/init.lua;./?.lua;/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/openresty/luajit/share/lua/5.1/?.lua;/usr/local/openresty/luajit/share/lua/5.1/?/init.lua;";
       lua_package_cpath "$prefix/deps/lib64/lua/5.1/?.so;$prefix/deps/lib/lua/5.1/?.so;;/usr/local/openresty/site/lualib/?.so;/usr/local/openresty/lualib/?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so;/usr/local/openresty/luajit/lib/lua/5.1/?.so;";
   
       lua_max_pending_timers 16384;
       lua_max_running_timers 4096;
   
       lua_shared_dict internal-status 10m;
       lua_shared_dict plugin-limit-req 10m;
       lua_shared_dict plugin-limit-count 10m;
       lua_shared_dict prometheus-metrics 100m;
       lua_shared_dict plugin-limit-conn 10m;
       lua_shared_dict upstream-healthcheck 10m;
       lua_shared_dict worker-events 10m;
       lua_shared_dict lrucache-lock 10m;
       lua_shared_dict balancer-ewma 10m;
       lua_shared_dict balancer-ewma-locks 10m;
       lua_shared_dict balancer-ewma-last-touched-at 10m;
       lua_shared_dict plugin-limit-count-redis-cluster-slot-lock 1m;
       lua_shared_dict tracing_buffer 10m; # plugin: skywalking
       lua_shared_dict plugin-api-breaker 10m;
       lua_shared_dict etcd-cluster-health-check 10m; # etcd health check
   
       # for openid-connect and authz-keycloak plugin
       lua_shared_dict discovery 1m; # cache for discovery metadata documents
   
       # for openid-connect plugin
       lua_shared_dict jwks 1m; # cache for JWKs
       lua_shared_dict introspection 10m; # cache for JWT verification results
   
       # for authz-keycloak
       lua_shared_dict access-tokens 1m; # cache for service account access tokens
   
       # for custom shared dict
   
       # for proxy cache
       proxy_cache_path /tmp/disk_cache_one levels=1:2 keys_zone=disk_cache_one:50m inactive=1d max_size=1G use_temp_path=off;
   
       # for proxy cache
       map $upstream_cache_zone $upstream_cache_zone_info {
           disk_cache_one /tmp/disk_cache_one,1:2;
       }
   
   
       lua_ssl_verify_depth 5;
       ssl_session_timeout 86400;
   
       underscores_in_headers on;
   
       lua_socket_log_errors off;
   
       resolver 169.254.20.10;
       resolver_timeout 5;
   
       lua_http10_buffering off;
   
       lua_regex_match_limit 100000;
       lua_regex_cache_max_entries 8192;
   
       log_format main escape=default '$remote_addr - [$remote_addr] - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id $host [$http_client_v] [$http_device_id] [$http_utm_source] [$http_platform_brand] [$scheme] [$route_name]';
       uninitialized_variable_warn off;
   
   
       access_log /dev/stdout main buffer=16384 flush=3;
       open_file_cache  max=1000 inactive=60;
       client_max_body_size 0;
       keepalive_timeout 75s;
       client_header_timeout 120s;
       client_body_timeout 120s;
       send_timeout 10s;
       variables_hash_max_size 2048;
   
       server_tokens off;
   
       include mime.types;
       charset utf-8;
   
       # error_page
       error_page 500 @50x.html;
   
       real_ip_header X-Real-IP;
   
       real_ip_recursive off;
   
       set_real_ip_from 127.0.0.1;
       set_real_ip_from unix:;
   
   
       # http configuration snippet starts
       tcp_nopush          on;
       tcp_nodelay         on;
   
       reset_timedout_connection on;
   
       keepalive_requests 100;
   
       client_body_temp_path           /tmp/client-body;
       fastcgi_temp_path               /tmp/fastcgi-temp;
       proxy_temp_path                 /tmp/proxy-temp;
   
       proxy_buffering                 off;
       proxy_buffer_size               32k;
       proxy_buffers                   8 32k;
   
       client_header_buffer_size       1k;
       large_client_header_buffers     4 8k;
       client_body_buffer_size         10m;
   
       types_hash_max_size             2048;
       server_names_hash_max_size      4096;
       server_names_hash_bucket_size   64;
   
       proxy_headers_hash_max_size     512;
       proxy_headers_hash_bucket_size  64;
   
       variables_hash_bucket_size      256;
   
       ignore_invalid_headers          on;
   
       gzip on;
       gzip_comp_level 1;
       gzip_http_version 1.1;
       gzip_min_length 256;
       gzip_types application/atom+xml application/javascript application/x-javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/javascript text/plain text/x-component;
       gzip_proxied any;
       gzip_vary on;
   
       # opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /usr/local/apisix/conf/opentracing.json;
       # opentracing on;
   
       map $http_x_request_id $req_id {
           default   $http_x_request_id;
           ""        $request_id;
       }
   
       log_format log_json escape=json '{"timestamp": "$time_local",'
           '"rmt_addr": "$remote_addr",'
           '"rmt_user": "$remote_user",'
           '"x_forwarded": "$http_x_forwarded_for",'
           '"ret_code": "$status",'
           '"req_meth": "$request_method",'
           '"req_host": "$host",'
           '"req_uri": "$request_uri",'
           '"req_body": "$request_body",'
           '"req_time": "$request_time",'
           '"res_time": "$upstream_response_time",'
           '"upstream_status": "$upstream_status",'
           '"upstream_addr": "$upstream_addr"'
           '}';
       # http configuration snippet ends
   
       upstream apisix_backend {
           server 0.0.0.1;
   
           balancer_by_lua_block {
               apisix.http_balancer_phase()
           }
   
           keepalive 320;
           keepalive_requests 1000;
           keepalive_timeout 60s;
       }
   
   
       init_by_lua_block {
           require "resty.core"
           apisix = require("apisix")
   
           local dns_resolver = { "169.254.20.10", }
           local args = {
               dns_resolver = dns_resolver,
           }
           apisix.http_init(args)
       }
   
       init_worker_by_lua_block {
           apisix.http_init_worker()
       }
   
       exit_worker_by_lua_block {
           apisix.http_exit_worker()
       }
   
       server {
           listen 127.0.0.1:9090;
   
           access_log off;
   
           location / {
               content_by_lua_block {
                   apisix.http_control()
               }
           }
   
           location @50x.html {
               set $from_error_page 'true';
               content_by_lua_block {
                   require("apisix.error_handling").handle_500()
               }
           }
       }
   
       server {
           listen 0.0.0.0:9091;
   
           access_log off;
   
           location / {
               content_by_lua_block {
                   local prometheus = require("apisix.plugins.prometheus")
                   prometheus.export_metrics()
               }
           }
   
           location = /apisix/nginx_status {
               allow 127.0.0.0/24;
               deny all;
               stub_status;
           }
       }
   
       server {
           listen 0.0.0.0:9180;
           log_not_found off;
   
           # admin configuration snippet starts
           access_log /home/logs/projectLog/admin.log log_json;
           # admin configuration snippet ends
   
           set $upstream_scheme             'http';
           set $upstream_host               $http_host;
           set $upstream_uri                '';
   
           location /apisix/admin {
                   allow 127.0.0.0/24;
                   allow 172.16.0.0/16;
                   deny all;
   
               content_by_lua_block {
                   apisix.http_admin()
               }
           }
   
           location @50x.html {
               set $from_error_page 'true';
               content_by_lua_block {
                   require("apisix.error_handling").handle_500()
               }
           }
       }
   
       server {
           listen 0.0.0.0:80 default_server reuseport;
           listen [::]:80 default_server reuseport;
           listen 0.0.0.0:443 ssl default_server http2 reuseport;
           listen [::]:443 ssl default_server http2 reuseport;
   
           server_name _;
   
           ssl_certificate      cert/ssl_PLACE_HOLDER.crt;
           ssl_certificate_key  cert/ssl_PLACE_HOLDER.key;
           ssl_session_cache    shared:SSL:20m;
           ssl_session_timeout 10m;
   
           ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
           ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
           ssl_prefer_server_ciphers on;
           ssl_session_tickets off;
   
           # http server configuration snippet starts
           http2_max_field_size            4k;
           http2_max_header_size           16k;
           http2_max_requests              1000;
           http2_max_concurrent_streams    128;
           # http server configuration snippet ends
   
           location = /apisix/nginx_status {
               allow 127.0.0.0/24;
               deny all;
               access_log off;
               stub_status;
           }
   
   
           ssl_certificate_by_lua_block {
               apisix.http_ssl_phase()
           }
   
           proxy_ssl_name $upstream_host;
           proxy_ssl_server_name on;
   
           location / {
               set $upstream_mirror_host        '';
               set $upstream_upgrade            '';
               set $upstream_connection         '';
   
               set $upstream_scheme             'http';
               set $upstream_host               $http_host;
               set $upstream_uri                '';
               set $ctx_ref                     '';
               set $from_error_page             '';
   
               # http server location configuration snippet starts
               if ($host ~* (\.int\.|\.pub\.)) {
                   # 生产环境不允许访问 int pub 实例
                   return 403 'deny';
               }
               set $route_name                  -;
               set $upstream_name               -;
   
               proxy_set_header X-Request-ID $req_id;
               add_header X-Request-ID $req_id;
   
               client_max_body_size             200m;
               # opentracing_propagate_context;
               # http server location configuration snippet ends
   
   
               access_by_lua_block {
                   apisix.http_access_phase()
               }
   
               proxy_http_version 1.1;
               proxy_set_header   Host              $upstream_host;
               proxy_set_header   Upgrade           $upstream_upgrade;
               proxy_set_header   Connection        $upstream_connection;
               proxy_set_header   X-Real-IP         $remote_addr;
               proxy_pass_header  Date;
   
               ### the following x-forwarded-* headers is to send to upstream server
   
               set $var_x_forwarded_for        $remote_addr;
               set $var_x_forwarded_proto      $scheme;
               set $var_x_forwarded_host       $host;
               set $var_x_forwarded_port       $server_port;
   
               if ($http_x_forwarded_for != "") {
                   set $var_x_forwarded_for "${http_x_forwarded_for}, ${realip_remote_addr}";
               }
               if ($http_x_forwarded_host != "") {
                   set $var_x_forwarded_host $http_x_forwarded_host;
               }
               if ($http_x_forwarded_port != "") {
                   set $var_x_forwarded_port $http_x_forwarded_port;
               }
   
               proxy_set_header   X-Forwarded-For      $var_x_forwarded_for;
               proxy_set_header   X-Forwarded-Proto    $var_x_forwarded_proto;
               proxy_set_header   X-Forwarded-Host     $var_x_forwarded_host;
               proxy_set_header   X-Forwarded-Port     $var_x_forwarded_port;
   
               ###  the following configuration is to cache response content from upstream server
   
               set $upstream_cache_zone            off;
               set $upstream_cache_key             '';
               set $upstream_cache_bypass          '';
               set $upstream_no_cache              '';
   
               proxy_cache                         $upstream_cache_zone;
               proxy_cache_valid                   any 10s;
               proxy_cache_min_uses                1;
               proxy_cache_methods                 GET HEAD POST;
               proxy_cache_lock_timeout            5s;
               proxy_cache_use_stale               off;
               proxy_cache_key                     $upstream_cache_key;
               proxy_no_cache                      $upstream_no_cache;
               proxy_cache_bypass                  $upstream_cache_bypass;
   
   
               proxy_pass      $upstream_scheme://apisix_backend$upstream_uri;
   
               mirror          /proxy_mirror;
   
               header_filter_by_lua_block {
                   apisix.http_header_filter_phase()
               }
   
               body_filter_by_lua_block {
                   apisix.http_body_filter_phase()
               }
   
               log_by_lua_block {
                   apisix.http_log_phase()
               }
           }
   
           location @grpc_pass {
   
               access_by_lua_block {
                   apisix.grpc_access_phase()
               }
   
               grpc_set_header   Content-Type application/grpc;
               grpc_socket_keepalive on;
               grpc_pass         $upstream_scheme://apisix_backend;
   
               header_filter_by_lua_block {
                   apisix.http_header_filter_phase()
               }
   
               body_filter_by_lua_block {
                   apisix.http_body_filter_phase()
               }
   
               log_by_lua_block {
                   apisix.http_log_phase()
               }
           }
   
   
           location = /proxy_mirror {
               internal;
   
               if ($upstream_mirror_host = "") {
                   return 200;
               }
   
               proxy_http_version 1.1;
               proxy_set_header Host $upstream_host;
               proxy_pass $upstream_mirror_host$request_uri;
           }
   
           location @50x.html {
               set $from_error_page 'true';
               content_by_lua_block {
                   require("apisix.error_handling").handle_500()
               }
               header_filter_by_lua_block {
                   apisix.http_header_filter_phase()
               }
   
               log_by_lua_block {
                   apisix.http_log_phase()
               }
           }
       }
       # http end configuration snippet starts
   
   
       # http end configuration snippet ends
   }
   ```


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zlhgo commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
zlhgo commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1032213986


   @tzssangglass 我只有这一个插件,只是设置了两个自定义变量。
   
   ky-ngx-vars.py
   ```lua
   local ngx = ngx
   local core = require("apisix.core")
   
   local schema = {
       type = "object",
       properties = {},
       required = {}
   }
   
   local metadata_schema = {
       type = "object",
       properties = {},
       required = {}
   }
   
   local plugin_name = "ky-ngx-vars"
   
   local _M = {
       version = 0.1,
       priority = 0,        -- TODO: add a type field, may be a good idea
       name = plugin_name,
       schema = schema
   }
   
   
   function _M.check_schema(conf, schema_type)
       if schema_type == core.schema.TYPE_METADATA then
           return core.schema.check(metadata_schema, conf)
       end
       return core.schema.check(schema, conf)
   end
   
   
   function _M.before_proxy(conf, ctx)
       ngx.var.route_name = ctx.matched_route.value.name
       ngx.var.upstream_name = ctx.matched_upstream.name
   
       core.log.debug("set $route_name=", ngx.var.route_name)
       core.log.debug("set $upstream_name=", ngx.var.upstream_name)
   end
   
   
   return _M
   
   ```


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] ilteriseroglu-ty commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
ilteriseroglu-ty commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1062875372


   I can reproduce this issue with a different setup; will make an issue detailing it


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] leslie-tsang commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1019082565


   Hello there, please provide the reproduction steps.
   then set your log level to `info`, put the **relevant error log** in desc.
   It's hard for people who trying to figure out what happened in you case.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] starsz commented on issue #6184: bug: balancer.lua:187: attempt to index local 'up_conf' (a nil value)

Posted by GitBox <gi...@apache.org>.
starsz commented on issue #6184:
URL: https://github.com/apache/apisix/issues/6184#issuecomment-1019480340


   Hi @zlhgo.
   Do you have any DIY plugins in your APISIX?


-- 
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-unsubscribe@apisix.apache.org

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