Skip to content

bug: admin api setting upstream config checks , functionclean_handlers is nil #1384

@aimpsmile

Description

@aimpsmile

Issue description

upstream conf eg:

{
    "desc": "AUTO-aimgo-web-v1.21-passport",
    "retries": 1,
    "key":"",
    "hash_on": "vars",
    "enable_websocket": false,
    "timeout": {
        "connect": 0.5,
        "send": 1,
        "read": 2
    },
    "checks": {
        "active": {
            "unhealthy": {
                "http_statuses": [
                    429,
                    404,
                    500,
                    501,
                    502,
                    503,
                    504,
                    505
                ],
                "interval": 1,
                "timeouts": 3,
                "http_failures": 2,
                "tcp_failures": 2
            },
            "type": "http",
            "http_path": "/health",
            "healthy": {
                "successes": 1,
                "interval": 2,
                "http_statuses": [
                    200,
                    302
                ]
            },
            "req_headers": [
                "User-Agent: apisix.health,curl/7.29.0"
            ],
            "timeout": 1,
            "https_verify_certificate": true,
            "concurrency": 10
        },
        "passive": {
            "unhealthy": {
                "http_failures": 3,
                "http_statuses": [
                    500,
                    501,
                    502,
                    503,
                    504,
                    505,
                    506
                ],
                "tcp_failures": 3,
                "timeouts": 7
            },
            "healthy": {
                "http_statuses": [
                    200,
                    201
                ],
                "successes": 3
            },
            "type": "http"
        }
    },
    "nodes": {
        "100.64.0.3:40940": 1
    },
    "type": "roundrobin"
}

first add config happen error, error info eg:

2020/04/01 17:34:12 [error] 5307#0: *21439 failed to run balancer_by_lua*: /usr/local/apisix/lua/apisix/balancer.lua:106: bad argument #1 to 'insert' (table expected, got nil)
stack traceback:
        [C]: in function 'insert'
        /usr/local/apisix/lua/apisix/balancer.lua:106: in function 'create_obj_fun'
        /usr/local/apisix/lua/apisix/core/lrucache.lua:66: in function 'lrucache_checker'
        /usr/local/apisix/lua/apisix/balancer.lua:127: in function 'fetch_healthchecker'
        /usr/local/apisix/lua/apisix/balancer.lua:248: in function 'pick_server'
        /usr/local/apisix/lua/apisix/balancer.lua:313: in function 'load_balancer'
        /usr/local/apisix/lua/apisix.lua:486: in function 'http_balancer_phase'
        balancer_by_lua:2: in main chunk while connecting to upstream, client: 192.168.132.181, server: , request: "GET /v1/passport/hello/222 HTTP/1.1", host: "web.uqudu.com:8888"

Environment

  • apisix version (cmd: apisix version): master And 1.0
  • OS: centos7

Minimal test code / Steps to reproduce the issue

  1. first call admin api write upstream config after request server api error occurred.
  2. restart apisix server, request server api get right
  3. guess should modify code ,not restart also is success! eg:
healthcheck_parent.clean_handlers = {}
upstream.parent.clean_handlers = {}

What's the actual result? (including assertion message & call stack if applicable)

What's the expected result?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions