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

[Bug Fix] Fix stack leaks in Lua events #2254

Merged
merged 1 commit into from
Jun 9, 2022

Conversation

hgtw
Copy link
Contributor

@hgtw hgtw commented Jun 8, 2022

EventItem was leaving the package table on the stack in successful
(non-encounter) calls and only popping the return. All events were
also leaking the full stack on lua_pcall errors. Lua mod callbacks
were popping error returns but leaking the table.

EventItem was leaving the package table on the stack in successful
(non-encounter) calls and only popping the return. All events were
also leaking the full stack on lua_pcall errors. Lua mod callbacks
were popping error returns but leaking the table.
@Kinglykrab Kinglykrab changed the title Fix stack leaks in Lua events [Bug Fix] Fix stack leaks in Lua events Jun 8, 2022
@Quintinon
Copy link
Contributor

Is there a different coding pattern or some generic checks that could be put in place to prevent this from happening again?

@hgtw
Copy link
Contributor Author

hgtw commented Jun 8, 2022

Avoiding returns in the middle of functions and using lua_settop(L, 0) to clear the stacks instead of popping tracked counts. I didn't want to add noise (and more testing) to this by refactoring things though

@Akkadius Akkadius merged commit 8ef3e87 into EQEmu:master Jun 9, 2022
@hgtw hgtw deleted the fix/lua-stack-leak branch July 31, 2022 23:01
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.

None yet

4 participants