Skip to content

use global variable sax_parser #30

@ZigzagAK

Description

@ZigzagAK

When we use xmlua with openresty we see warning:

2022/12/09 12:15:51 [warn] 289839#289839: *218 [lua] _G write guard:12: __newindex(): writing a global Lua variable ('sax_parser') which may lead to race conditions between concurrent requests,
stack traceback:
lib/xmlua/xml-stream-sax-parser.lua:74: in function 'ensure_sax_parser'
lib/xmlua/xml-stream-sax-parser.lua:83: in function 'parse'
lua/globals/xml.lua:159: in function 'decode_xml'

Need to add 'local' keyword.

https://github.com/clear-code/xmlua/blob/master/xmlua/xml-stream-sax-parser.lua#L74

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