Skip to content

Commit bbd13eb

Browse files
committed
fix possible crash while removing peer under highload because request context contents pointer to peer from zone shm -> lazy free memory
1 parent 0a37ea0 commit bbd13eb

12 files changed

+908
-283
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ http {
4343
listen 6000;
4444
4545
location /dynamic {
46-
allow 127.0.0.1;
46+
allow 127.0.0.1;
4747
deny all;
4848
dynamic_upstream;
4949
}
5050
5151
location / {
52-
proxy_pass http://backends;
52+
proxy_pass http://backends;
5353
}
5454
}
5555
}
@@ -87,19 +87,19 @@ $
8787

8888
```bash
8989
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&verbose="
90-
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
91-
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
92-
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10;
90+
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
91+
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
92+
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
9393
$
9494
```
9595

9696
## update_parameters
9797

9898
```bash
99-
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&server=127.0.0.1:6003&weight=10&max_fails=5&fail_timeout=5"
100-
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
101-
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
102-
server 127.0.0.1:6003 weight=10 max_fails=5 fail_timeout=5;
99+
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&server=127.0.0.1:6003&weight=10&max_fails=5&fail_timeout=5&max_conns=10"
100+
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
101+
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
102+
server 127.0.0.1:6003 weight=10 max_fails=5 fail_timeout=5 max_conns=10 conns=0;
103103
$
104104
```
105105

@@ -113,19 +113,19 @@ The supported parameters are below.
113113

114114
```bash
115115
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&server=127.0.0.1:6003&down="
116-
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
117-
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
118-
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 down;
116+
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
117+
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
118+
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0 down;
119119
$
120120
```
121121

122122
## up
123123

124124
```bash
125125
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&server=127.0.0.1:6003&up="
126-
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
127-
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
128-
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10;
126+
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
127+
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
128+
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
129129
$
130130
```
131131

config

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
ngx_addon_name=ngx_dynamic_upstream_module
1+
ngx_addon_name="ngx_http_dynamic_upstream_module"
22

3-
DYNAMIC_UPSTREAM_SRCS=" \
4-
$ngx_addon_dir/src/ngx_dynamic_upstream_module.c \
5-
$ngx_addon_dir/src/ngx_dynamic_upstream_op.c \
6-
$ngx_addon_dir/src/ngx_inet_slab.c \
3+
DYNAMIC_UPSTREAM_SRCS=" \
4+
$ngx_addon_dir/src/ngx_http_dynamic_upstream_module.c \
5+
$ngx_addon_dir/src/ngx_dynamic_upstream_op.c \
6+
$ngx_addon_dir/src/ngx_inet_slab.c \
77
"
88

99
DYNAMIC_UPSTREAM_DEPS=" \

0 commit comments

Comments
 (0)