jdesgats / ljsonschema

Pure Lua JSON schema validator
MIT License
47 stars 21 forks source link

Incompatable with OpenResty #4

Open gsomgsom opened 6 years ago

gsomgsom commented 6 years ago

Running example in LUA 5.1 is good. But when i'm trying to run example in OpenResty (with LuaJIT), it rises an error:

ERROR: attempt to yield across C-call boundary
stack traceback:
coroutine.wrap:21: in function
[C]: in function 'load'
./jsonschema/init.lua:169: in function 'generate_validator' test.lua:5: in function 'file_gen'
init_worker_by_lua:45: in function [C]: in function 'xpcall'
init_worker_by_lua:52: in function

jdesgats commented 6 years ago

Thank you for your report. It turns out that openresty replace the coroutine API with its own one, that causes this error...

Not sure yet if this is a bug on the nginx-lua-module, or if that behaviour is expected.

Nevertheless, this is fixed by 09dccc59d96d88df352c0103344bb219f9e7579b that you can use with the borken-coro branch. But I need to asses the exact overhead of this fix before merging it.

gsomgsom commented 6 years ago

Thanks! It works fine for my project.