Skip to content

Commit

Permalink
fix possible crash while removing peer under highload because request…
Browse files Browse the repository at this point in the history
… context contents pointer to peer from zone shm -> lazy free memory
  • Loading branch information
ZigzagAK committed Jun 27, 2018
1 parent 0a37ea0 commit bbd13eb
Show file tree
Hide file tree
Showing 12 changed files with 908 additions and 283 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ http {
listen 6000;
location /dynamic {
allow 127.0.0.1;
allow 127.0.0.1;
deny all;
dynamic_upstream;
}
location / {
proxy_pass http://backends;
proxy_pass http://backends;
}
}
}
Expand Down Expand Up @@ -87,19 +87,19 @@ $

```bash
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&verbose="
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
$
```

## update_parameters

```bash
$ 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"
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6003 weight=10 max_fails=5 fail_timeout=5;
$ 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"
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6003 weight=10 max_fails=5 fail_timeout=5 max_conns=10 conns=0;
$
```

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

```bash
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&server=127.0.0.1:6003&down="
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 down;
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0 down;
$
```

## up

```bash
$ curl "http://127.0.0.1:6000/dynamic?upstream=zone_for_backends&server=127.0.0.1:6003&up="
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10;
server 127.0.0.1:6001 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6002 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
server 127.0.0.1:6003 weight=1 max_fails=1 fail_timeout=10 max_conns=0 conns=0;
$
```

Expand Down
10 changes: 5 additions & 5 deletions config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ngx_addon_name=ngx_dynamic_upstream_module
ngx_addon_name="ngx_http_dynamic_upstream_module"

DYNAMIC_UPSTREAM_SRCS=" \
$ngx_addon_dir/src/ngx_dynamic_upstream_module.c \
$ngx_addon_dir/src/ngx_dynamic_upstream_op.c \
$ngx_addon_dir/src/ngx_inet_slab.c \
DYNAMIC_UPSTREAM_SRCS=" \
$ngx_addon_dir/src/ngx_http_dynamic_upstream_module.c \
$ngx_addon_dir/src/ngx_dynamic_upstream_op.c \
$ngx_addon_dir/src/ngx_inet_slab.c \
"

DYNAMIC_UPSTREAM_DEPS=" \
Expand Down
Loading

0 comments on commit bbd13eb

Please sign in to comment.