Skip to content

keep session alive#352

Merged
actboy168 merged 1 commit intoactboy168:masterfrom
fesily:keep-session-alive
May 7, 2026
Merged

keep session alive#352
actboy168 merged 1 commit intoactboy168:masterfrom
fesily:keep-session-alive

Conversation

@fesily
Copy link
Copy Markdown
Contributor

@fesily fesily commented May 7, 2026

Add keepSessionAlive configuration to maintain debug session across VM restart

…M restarts

Co-authored-by: Copilot <copilot@github.com>
@fesily fesily changed the title Add keepSessionAlive configuration to maintain debug session across V… keep session alive May 7, 2026
@fesily
Copy link
Copy Markdown
Contributor Author

fesily commented May 7, 2026

不释放master线程,持久化调试器模块.我记得之前一直是持久化的, 中间谁加了补丁修了这个问题

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a "keepSessionAlive" configuration option to maintain the debug session when the Lua VM is closed and recreated. Feedback suggests localizing the "ExitGuard" variable to prevent premature garbage collection and notes a potential issue where the master thread might not be cleaned up in subsequent sessions if the setting is changed, as the cleanup guard is only initialized during the master thread's creation.

Comment thread extension/script/backend/bootstrap.lua
Comment on lines +39 to +41
if keepSessionAlive then
return
end
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

When keepSessionAlive is enabled, the ExitGuard returns early, which correctly keeps the master thread alive across VM restarts. However, since ExitGuard is only created in initMaster (when the master is first started), subsequent debug sessions that attach to the existing master will not have an ExitGuard of their own.

This means that if a user later sets keepSessionAlive to false in a subsequent session, the master thread will still not be cleaned up when that session ends, as there is no guard in the new VM to trigger the exit logic. This results in the master thread persisting until the host process terminates. Consider if m.attach should also register a cleanup guard.

@actboy168 actboy168 merged commit f3ff547 into actboy168:master May 7, 2026
6 checks passed
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.

2 participants