Prevent zombie Blooms and restore trying many ports (BL-15551)#7528
Prevent zombie Blooms and restore trying many ports (BL-15551)#7528andrew-polk merged 2 commits intomasterfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR implements a robust shutdown mechanism to prevent zombie Bloom processes that block new instances from starting. The solution introduces a forced shutdown timeout after 20 seconds, replaces all Application.Exit() calls with a custom Program.Exit() method, and refactors server cleanup logic.
Key Changes
- Added
Program.Exit()method with a 20-second timeout mechanism that forcefully terminates Bloom if normal shutdown hangs - Systematically replaced all
Application.Exit()calls withProgram.Exit()across 7 files - Extracted
CloseListener()method from BloomServer's Dispose for reusability in forced shutdown - Simplified
HandleExceptionOpeningPort()to use console logging instead of NonFatalProblem reporting, enabling quiet retry of multiple ports
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/BloomExe/Program.cs | Added Exit() with forced shutdown timer, ReleaseBloomToken() extraction, and _gotUniqueToken field |
| src/BloomExe/web/BloomServer.cs | Extracted CloseListener() method and simplified port retry error handling |
| src/BloomExe/web/BloomWebSocketServer.cs | Updated to use Program.Exit() instead of Application.Exit() |
| src/BloomExe/ProjectContext.cs | Updated to use Program.Exit() instead of Application.Exit() |
| src/BloomExe/MiscUI/BrowserProgressDialog.cs | Updated to use Program.Exit() instead of Application.Exit() |
| src/BloomExe/InstallerSupport.cs | Updated to use Program.Exit() instead of Application.Exit() |
| src/BloomExe/FatalExceptionHandler.cs | Updated to use Program.Exit() instead of Application.Exit() |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/BloomExe/Program.cs
Outdated
| { | ||
| Program.ReleaseBloomToken(); | ||
| } | ||
| catch (Exception) { } |
There was a problem hiding this comment.
Poor error handling: empty catch block.
| catch (Exception) { } | |
| catch (Exception ex) | |
| { | |
| // If we can't log it, at least write to Console.Error. | |
| Console.Error.WriteLine("Exception during ReleaseBloomToken: " + ex); | |
| } |
StephenMcConnel
left a comment
There was a problem hiding this comment.
@StephenMcConnel reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @JohnThomson)
|
Is it worth trying to future-proof things such that we can't call Application.Exit() other than from here? |
andrew-polk
left a comment
There was a problem hiding this comment.
@andrew-polk reviewed 7 of 7 files at r1, all commit messages.
@andrew-polk dismissed @copilot-pull-request-reviewer[bot] from a discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @JohnThomson)
|
@andrew-polk I've opened a new pull request, #7533, to work on those changes. Once the pull request is ready, I'll request review from you. |
andrew-polk
left a comment
There was a problem hiding this comment.
@andrew-polk dismissed @copilot-pull-request-reviewer[bot] from a discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @JohnThomson)
|
@andrew-polk I've opened a new pull request, #7534, to work on those changes. Once the pull request is ready, I'll request review from you. |
andrew-polk
left a comment
There was a problem hiding this comment.
@andrew-polk reviewed 10 of 10 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @JohnThomson)
andrew-polk
left a comment
There was a problem hiding this comment.
@andrew-polk dismissed @copilot-pull-request-reviewer[bot] from a discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @JohnThomson)
|
@andrew-polk I've opened a new pull request, #7535, to work on those changes. Once the pull request is ready, I'll request review from you. |
JohnThomson
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved
src/BloomExe/Program.cs line 1304 at r1 (raw file):
Previously, andrew-polk wrote…
Is it worth trying to future-proof things such that we can't call Application.Exit() other than from here?
(We have other c#-based checks we run for this kind of thing...)
Done.
This change is