Skip to content
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

Database request error : "Attempt to yield across C-call boundary" #791

Open
iThorgrim opened this issue Aug 24, 2024 · 0 comments
Open

Comments

@iThorgrim
Copy link

iThorgrim commented Aug 24, 2024

Hello,

I am encountering an issue while using lapis.db.query in an OpenResty environment with Lua 5.1. When executing a simple SQL query via lapis.db.query, the following error occurs:

2024/08/24 13:18:11 [error] 4349#4349: *1 lua entry thread aborted: runtime error: attempt to yield across C-call boundary
stack traceback:
coroutine 0:
        [C]: in function 'require'
        /usr/local/share/lua/5.1/lapis/init.lua:15: in function 'serve'
        content_by_lua(nginx.conf.compiled:22):2: in main chunk, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "127.0.0.1:8080"

Here is a minimal example of my code:

local db = require("lapis.db")

function model.loadModules()
    local result = db.query("SELECT * FROM modules WHERE active = 1")
    error("ok")
    -- Further processing
end

The error occurs immediately after executing the SQL query, even before reaching the error("ok") statement.

I am confident that the issue is related to the execution of the SQL query, as the error disappears when I comment out the db.query call.

Environment:

  • OpenResty
  • Lua 5.1 (Tested with Lua5.2, Lua5.3, Lua5.4, LuaJit)
  • Lapis version 1.16.0
  • Database used: Mariadb (with libmariadb-compat installed)
  • Linux Debian 12

Note:
All dependencies are up to date. I have not modified the default configuration of Lapis (only for addin my DB, like this : mysql = {host = "127.0.0.1", user = "bob", password = "bob", database = "prod_website"}

@iThorgrim iThorgrim changed the title Database request error Attempt to yield across C-call boundary Database request error : "Attempt to yield across C-call boundary" Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant