New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"attempt to yield across C-call boundary" occur while connect() #3
Comments
If we put get_rtdb() into a function, it works well. https://gist.github.com/raw/2329313/691fac7cbfac56ea331c1866e0c32400d271942d/testm1.lua
|
It seems that the require function is implemented as a C function, which cannot be yielded in the middle of the require call. The LuaJIT implementation does not support yielding across the C function call boundary, just like the standard Lua 5.1 interpreter. Your work-around indeed eliminated this and hence worked. |
It looks like you said. |
Sorry if I’m stealing this issue, but I still don’t get how to work around this. Here’s my situation:
So I have this wrapper mainly because my application can run either with or without openresty and because I wanted to avoid copy-pasting (the somewhat big) database connection code. The error message is the same ( |
@yangm97 Your usage is wrong. Please read the documentation more carefully: |
@yangm97 Also, read the discussion above. |
I read both. Also I kind see where it’s failing and why (“The |
seems set on ngx.ctx works for me
|
But it is a short lifetime(request) by using ngx.ctx |
I package redis functions into a module testdb.lua, and include it in another module testm.lua.
testm.lua is required in test.lua, which is running by ngx_lua:
Finally, the error occur:
The first ngx.log() is excuted, but second not. So is there anything wrong in redis:connect()?
All the files could be found in: https://gist.github.com/2329313
thanks.
The text was updated successfully, but these errors were encountered: