SkyeYoung commented on issue #12432:
URL: https://github.com/apache/apisix/issues/12432#issuecomment-3139301911
Hi, I tried to build a minimum environment based on the scene and
reproduction steps you provided, But I couldn't reproduce your results.
I have provided my configuration and test steps below.
Please reply if there's a problem with my testing method. It's best if you,
like me, can provide a minimal, directly runnable environment to help you
troubleshoot the issue.
steps:
```console
$ docker compose up -d nginx-2 nginx
[+] Running 2/2
✔ Container test-nginx-2 Started
0.3s
✔ Container test-nginx Started
0.3s
$ curl -X PUT "http://127.0.0.1:9180/apisix/admin/upstreams/1" -H "X-AP
I-KEY: $APISIX_ADMIN_KEY" -H "Content-Type: application/json"
--data-binary @./p-12432/upstream.json
{"key":"/apisix/upstreams/1","value":{"keepalive_pool":{"requests":1000,"idle_timeout":60,"size":320},"scheme":"http","nodes":[{"host":"127.0.0.1","port":1980,"weight":1,"priority":0},{"host":"127.0.0.1","port":1981,"weight":1,"priority":0}],"create_time":1753950615,"id":"1","hash_on":"vars","checks":{"active":{"healthy":{"http_statuses":[200,302,404],"interval":5,"successes":2},"http_path":"/","https_verify_certificate":true,"unhealthy":{"http_statuses":[429,500,501,502,503,504,505,599],"interval":1,"http_failures":2,"tcp_failures":2,"timeouts":2},"concurrency":10,"type":"http","timeout":3}},"name":"test-health","type":"roundrobin","pass_host":"pass","timeout":{"send":600,"read":600,"connect":6},"update_time":1753954937}}
(reverse-i-search)`curl': make run && ^Crl
http://localhost:9091/apisix/prometheus/metrics
$ curl -X PUT "http://127.0.0.1:9180/apisix/admin/routes/1" -H "X-API-K
EY: $APISIX_ADMIN_KEY" -H "Content-Type: application/json" --data-binary
@./p-12432/route.json
{"key":"/apisix/routes/1","value":{"update_time":1753954973,"upstream_id":"1","priority":0,"create_time":1753345108,"id":"1","status":1,"methods":["GET"],"name":"rotuer-4-test-healthy","uris":["/ping","/health"]}}
$ curl http://127.0.0.1:9090/v1/healthcheck/upstreams/1
{"name":"/apisix/upstreams/1","type":"http","nodes":{}}
$ curl http://127.0.0.1:9080/ping
ok
$ curl http://127.0.0.1:9080/ping
ok
$ curl http://127.0.0.1:9090/v1/healthcheck/upstreams/1
{"name":"/apisix/upstreams/1","type":"http","nodes":[{"counter":{"success":0,"http_failure":0,"tcp_failure":0,"timeout_failure":0},"status":"healthy","ip":"127.0.0.1","hostname":"127.0.0.1","port":1980},{"counter":{"success":0,"http_failure":0,"tcp_failure":0,"timeout_failure":0},"status":"healthy","port":1981,"hostname":"127.0.0.1","ip":"127.0.0.1"}]}
$ docker compose down nginx
[+] Running 2/2
✔ Container test-nginx Removed
0.3s
! Network common_for_apisix_default Resource is still in use
0.0s
$ curl http://127.0.0.1:9090/v1/healthcheck/upstreams/1
{"name":"/apisix/upstreams/1","type":"http","nodes":[{"status":"unhealthy","ip":"127.0.0.1","hostname":"127.0.0.1","counter":{"success":0,"http_failure":0,"tcp_failure":2,"timeout_failure":0},"port":1980},{"status":"healthy","port":1981,"hostname":"127.0.0.1","counter":{"success":0,"http_failure":0,"tcp_failure":0,"timeout_failure":0},"ip":"127.0.0.1"}]}
$ curl http://127.0.0.1:9080/ping
ok
$ curl http://127.0.0.1:9090/v1/healthcheck/upstreams/1
{"name":"/apisix/upstreams/1","type":"http","nodes":[{"counter":{"success":0,"timeout_failure":0,"tcp_failure":2,"http_failure":0},"status":"unhealthy","ip":"127.0.0.1","hostname":"127.0.0.1","port":1980},{"counter":{"success":0,"timeout_failure":0,"tcp_failure":0,"http_failure":0},"status":"healthy","port":1981,"hostname":"127.0.0.1","ip":"127.0.0.1"}]}
```
env:
<details>
<summary>Details</summary>
```yaml
# docker-compose.yaml
services:
apisix:
image: 'apache/apisix:3.13.0-ubuntu'
restart: always
volumes:
- ./apisix_conf.yaml:/usr/local/apisix/conf/config.yaml:ro
network_mode: "host"
nginx:
image: nginx:alpine
container_name: test-nginx
ports:
- "1980:1980"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider",
"http://localhost:1980"]
interval: 10s
timeout: 5s
retries: 3
nginx-2:
image: nginx:alpine
container_name: test-nginx-2
ports:
- "1981:1981"
volumes:
- ./nginx-2.conf:/etc/nginx/nginx.conf:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider",
"http://localhost:1980"]
interval: 10s
timeout: 5s
retries: 3
etcd:
image: bitnami/etcd:3.6
container_name: test-etcd
ports:
- "2379:2379"
environment:
- ETCD_DATA_DIR=/etcd_data
- ETCD_ENABLE_V2=true
- ALLOW_NONE_AUTHENTICATION=yes
- ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379
- ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:2379/version || exit 1"]
interval: 10s
timeout: 5s
retries: 3
```
```yaml
# apisix_conf.yaml
deployment:
role: traditional
role_traditional:
config_provider: etcd
etcd:
host:
- http://127.0.0.1:2379
admin:
admin_key:
- name: admin
key: 'xxx' # using fixed API token has security risk, please update
it when you deploy to production environment. If passed empty then will be
autogenerated by APISIX and will be written back here. Recommended is to use
external mechanism to generate and store the token.
role: admin
```
```nginx.conf
// nginx-2.conf
master_process on;
worker_processes 1;
events {
worker_connections 4096;
}
http {
resolver ipv6=off 8.8.8.8;
access_log off;
server_tokens off;
keepalive_requests 10000000;
server {
listen 1981;
server_name _;
location / {
return 200 "world\n";
}
location /ping {
return 200 "ok\n";
}
}
}
```
```nginx.conf
// nginx.conf
master_process on;
worker_processes 1;
events {
worker_connections 4096;
}
http {
resolver ipv6=off 8.8.8.8;
access_log off;
server_tokens off;
keepalive_requests 10000000;
server {
listen 1980;
server_name _;
location / {
return 200 "hello\n";
}
location /ping {
return 200 "ok\n";
}
}
}
```
```json5
// route.json
{
"uris": [
"/ping",
"/health"
],
"name": "rotuer-4-test-healthy",
"methods": [
"GET"
],
"upstream_id": "1",
"status": 1
}
```
```json5
// upstream.json
{
"nodes": [
{
"host": "127.0.0.1",
"port": 1980,
"weight": 1
},
{
"host": "127.0.0.1",
"port": 1981,
"weight": 1
}
],
"timeout": {
"connect": 6,
"send": 600,
"read": 600
},
"type": "roundrobin",
"checks": {
"active": {
"concurrency": 10,
"healthy": {
"http_statuses": [
200,
302,
404
],
"interval": 5,
"successes": 2
},
"http_path": "/",
"timeout": 3,
"type": "http",
"unhealthy": {
"http_failures": 2,
"http_statuses": [
429,
500,
501,
502,
503,
504,
505,
599
],
"interval": 1,
"tcp_failures": 2,
"timeouts": 2
}
}
},
"scheme": "http",
"pass_host": "pass",
"name": "test-health",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
}
}
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]