Skip to content

Warning on global variable usages #82

Open
@gurumark

Description

@gurumark

Hi,
I get the following warnings when the debug is turned on:

today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('formatTarget') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:12: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('redirect') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:19: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('proxy') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:24: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 2020/03/17 15:20:44 [warn] 13#13: *34 [lua] _G write guard:12: __newindex(): writing a global lua variable ('routeRequest') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:20 AM stack traceback:
today at 11:20 AM /usr/local/openresty/nginx/lualib/router.lua:29: in main chunk, client: 207.46.13.223, server: , request: "GET / HTTP/1.1", host: "wpworkplace.com"
today at 11:20 AM 207.46.13.223 - - [17/Mar/2020:15:20:44 +0000] "GET / HTTP/1.1" 301 175 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
today at 11:20 AM 2020/03/17 15:20:44 [info] 13#13: *34 client 207.46.13.223 closed keepalive connection
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('starts_with') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:3: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('ends_with') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:7: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('starts_with_protocol') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:11: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('has_trailing_slash') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/utils.lua:15: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/redis.lua:2: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:1: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getRouteKeyForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:5: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getSettingsKeyForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:9: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('targetIsInValid') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:13: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getTargetForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:17: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getModeForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:40: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('getRouteForSource') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/ceryx/routes.lua:52: in main chunk
today at 11:22 AM [C]: in function 'require'
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:2: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [debug] 13#13: *36 [lua] redis.lua:14: client(): Preparing Redis client.
today at 11:22 AM 2020/03/17 15:22:03 [debug] 13#13: *36 [lua] redis.lua:27: client(): Redis client prepared.
today at 11:22 AM 2020/03/17 15:22:03 [debug] 13#13: *36 [lua] redis.lua:37: client(): Authenticated with Redis.
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('formatTarget') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:12: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('redirect') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:19: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('proxy') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:
today at 11:22 AM /usr/local/openresty/nginx/lualib/router.lua:24: in main chunk, client: 10.0.0.3, server: , request: "POST /wp-admin/admin-ajax.php HTTP/1.1", host: "blogwp.com", referrer: "http://blogwp.com/wp-admin/admin.php?page=intrapress_settings"
today at 11:22 AM 2020/03/17 15:22:03 [warn] 13#13: *36 [lua] _G write guard:12: __newindex(): writing a global lua variable ('routeRequest') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
today at 11:22 AM stack traceback:

All of these variables need to be declared as local.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions