Skip to content

Task 194243#8

Open
balupillai wants to merge 11 commits intomainfrom
TASK-194243
Open

Task 194243#8
balupillai wants to merge 11 commits intomainfrom
TASK-194243

Conversation

@balupillai
Copy link
Contributor

@balupillai balupillai commented Feb 11, 2026

Note

Medium Risk
Touches core runtime error/locking code paths; mistakes could alter error propagation or reintroduce deadlocks/crashes, though changes are narrowly scoped and largely additive logging/guarding.

Overview
Hardens Lua error propagation/panic paths by removing an unconditional lua_unlock(L) in luaD_throw’s no-handler (panic) branch that could double-unlock and corrupt the pthread mutex during re-throws.

Adds low-frequency critical logging for otherwise-unhandled errors: lua_error, luaG_errormsg, and LUAI_TRY_END now emit DCRITICAL logs only when there is no outer error handler, using raw stack accessors to avoid lock re-entry/deadlocks.

Improves string.dump failure diagnostics by including function identity/source location details via lua_getinfo in the raised error message.

Written by Cursor Bugbot for commit fbf904b. This will update automatically on new commits. Configure here.

* lua_lock() on this lua_State fail with EINVAL and abort().
* All direct callers of luaD_throw (lmem.c, ldebug.c, lundump.c,
* llex.c) always have an outer errorJmp so they never reach
* this panic branch. */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Panic callback runs under Lua lock

Medium Severity

Removing lua_unlock(L) means G(L)->panic(L) now executes while the state lock may still be held. In unprotected error paths, panic handlers that call back into Lua APIs can block or fail on re-lock, changing panic behavior from prior releases.

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

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

Successfully merging this pull request may close these issues.

1 participant