"_G write guard" warns that race conditions may occur on APIcast

Solution Verified - Updated -

Issue

  • Apicast logs these warn messages. What do the messages mean?
2020/08/01 00:00:00 [warn] 15#15: *2 [lua] _G write guard:12: __newindex(): writing a global Lua variable ('sanitize_replace') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
stack traceback:
        /usr/local/share/lua/5.1/liquid.lua:132: in main chunk
        [C]: in function 'require'
        /opt/app-root/src/src/apicast/cli/template.lua:13: in main chunk
        [C]: in function 'require'
        /opt/app-root/src/src/apicast/cli/command/start.lua:17: in main chunk
        [C]: in function 'require'
        /opt/app-root/src/src/apicast/cli.lua:18: in function 'load_commands'
        /opt/app-root/src/src/apicast/cli.lua:23: in main chunk
        [C]: in function 'require'
        /tmp/xxxxxxxx:60: in function 'file_gen'
        init_worker_by_lua:49: in function <init_worker_by_lua:47>
        [C]: in function 'xpcall'
        init_worker_by_lua:56: in function <init_worker_by_lua:54>, context: ngx.timer
2020/08/01 00:00:00 [warn] 15#15: *2 [lua] _G write guard:12: writing a global Lua variable ('yaml') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
stack traceback:
        [C]: at 0x7fafc162f140
        [C]: in function 'require'
        /usr/local/share/lua/5.1/lyaml/init.lua:34: in main chunk
        [C]: in function 'require'
        /opt/app-root/src/src/resty/yaml.lua:6: in main chunk
        [C]: in function 'require'
        ...p-root/src/src/apicast/configuration_loader/data_url.lua:9: in main chunk
        [C]: in function 'require'
        /opt/app-root/src/src/apicast/configuration_loader.lua:5: in main chunk
        [C]: in function 'root_require'
        ...
        [C]: in function 'require'
        /opt/app-root/src/src/apicast/cli/command/start.lua:18: in main chunk
        [C]: in function 'require'
        /opt/app-root/src/src/apicast/cli.lua:18: in function 'load_commands'
        /opt/app-root/src/src/apicast/cli.lua:23: in main chunk
        [C]: in function 'require'
        /tmp/xxxxxxxx:60: in function 'file_gen'
        init_worker_by_lua:49: in function <init_worker_by_lua:47>
        [C]: in function 'xpcall'
        init_worker_by_lua:56: in function <init_worker_by_lua:54>, context: ngx.timer
2020/08/01 00:00:00 [warn] 15#15: *2 [lua] _G write guard:12: __newindex(): writing a global Lua variable ('result') which may lead to race conditions between concurrent requests, so prefer the use of 'local' variables
stack traceback:
        /usr/local/share/lua/5.1/liquid.lua:134: in function 'sanitize_replace'
        /usr/local/share/lua/5.1/liquid.lua:2998: in function </usr/local/share/lua/5.1/liquid.lua:2996>
        [C]: in function 'pcall'
        /usr/local/share/lua/5.1/liquid.lua:2423: in function 'visit'
        /usr/local/share/lua/5.1/liquid.lua:2042: in function 'visit'
        /usr/local/share/lua/5.1/liquid.lua:2018: in function 'visit'
        /usr/local/share/lua/5.1/liquid.lua:2501: in function 'visit'
        /usr/local/share/lua/5.1/liquid.lua:2018: in function 'visit'
        /usr/local/share/lua/5.1/liquid.lua:2018: in function 'interpret'
        /usr/local/share/lua/5.1/liquid.lua:2453: in function 'visit'
        ...
        /usr/local/share/lua/5.1/liquid.lua:2018: in function 'visit'
        /usr/local/share/lua/5.1/liquid.lua:2269: in function 'visit'
        /usr/local/share/lua/5.1/liquid.lua:2018: in function 'render'
        /opt/app-root/src/src/apicast/cli/command/start.lua:57: in function 'nginx_config'
        /opt/app-root/src/src/apicast/cli/command/start.lua:171: in function 'start'
        /opt/app-root/src/src/apicast/cli.lua:50: in function </opt/app-root/src/src/apicast/cli.lua:30>
        /tmp/xxxxxxxx:60: in function 'file_gen'
        init_worker_by_lua:49: in function <init_worker_by_lua:47>
        [C]: in function 'xpcall'
        init_worker_by_lua:56: in function <init_worker_by_lua:54>, context: ngx.timer

Environment

  • Red Hat 3scale API Management
    • 2.7
    • 2.8
    • 2.9
    • 2.10

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content