openresty/lua-upstream-nginx-module

openresty-1.13.6.1 - get_primary_peers() and get_backup_peers() fail to return a proper peer's tables

Unigoge opened this issue · 2 comments

Hi,

I have a simple upstream configuration

upstream default {

        zone backend_default 512k;
        
        server 1.1.1.1 max_fails=30 fail_timeout=1;
        server 2.2.2.2 backup;
        server 3.3.3.3 backup;
        keepalive 1000;
}

inside my code I have this

                local backup_servers = upstream_conf.get_backup_peers( "default" );
                ngx.log( ngx.DEBUG, "Backups:\n", utils.serializeTable( backup_servers ));

...which prints this into log file...

2018/05/18 20:12:34 [error] 15726#15726: *5 [lua] tilecache_balancer.lua:113: check_upstreams(): Backups:
{
 1 = {
  current_weight = 0,
  id = 0,
  name = "2.2.2.2:80",
  conns = 0,
  weight = 1,
  fail_timeout = 10,
  effective_weight = 1,
  fails = 0,
  max_fails = 1,
 },
 2 = {
  current_weight = 0,
  id = 1,
  name = "",
  conns = 1.405243031191e+14,
  accessed = 1.4052430311923e+14,
  checked = 12,
  weight = 0,
  fail_timeout = 0,
  effective_weight = 0,
  fails = 15,
  max_fails = 1.4052430312251e+14,
 },
}, client: 127.0.0.1, server: _, request: "GET /health_check HTTP/1.1", host: "127.0.0.1"

...the table for a second backup server looks corrupted ...I have tried to add a second server to primary peers - it also doesn't work properly...

Thanks,
Gene

@Unigoge This module does not work with the zone directive. This is a known limitation.

Thanks! Good to know :)