Repository navigation
Commit 7d189b3
bugfix: balancer.bind_to_local_addr() crashed the worker on an invalid address.
ngx_parse_addr_port() returns NGX_DECLINED when the text is not an
address; NGX_ERROR only means an allocation failed. The FFI function only
checked for NGX_ERROR, so an invalid address such as "not-an-ip" was
reported as success, and an ngx_addr_t whose sockaddr was never set (it
comes from ngx_palloc()) was published to bp->local. The upstream connect
then called ngx_inet_get_port() and bind() on that pointer, and the worker
exited on signal 11.
Treat anything but NGX_OK as an invalid address and keep the previous
bp->local, as ngx_stream_lua_ffi_balancer_bind_to_local_addr() already
does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent d9d95ab commit 7d189b3
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1006 | 1006 | | |
1007 | 1007 | | |
1008 | 1008 | | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
1009 | 1013 | | |
1010 | | - | |
| 1014 | + | |
1011 | 1015 | | |
1012 | 1016 | | |
1013 | 1017 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
0 commit comments