keep session alive#352
Conversation
…M restarts Co-authored-by: Copilot <copilot@github.com>
|
不释放master线程,持久化调试器模块.我记得之前一直是持久化的, 中间谁加了补丁修了这个问题 |
There was a problem hiding this comment.
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.
| if keepSessionAlive then | ||
| return | ||
| end |
There was a problem hiding this comment.
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.
Add keepSessionAlive configuration to maintain debug session across VM restart