Fix #228: Replace hardcoded port 1108 with dynamic port allocation, s… - #239
Open
Ashutosh Mishra (Ashut0sh-mishra) wants to merge 1 commit into
Open
Conversation
…cation, scope ngrok cleanup - comet_server.py: Replace HTTP_SERVER_PORT=1108 with find_free_port() that binds to port 0 to get an OS-assigned available port - comet_server.py: Use self.port instance variable for per-server port - comet_requester.py: Remove global ngrok.kill() from finally block; server.shutdown() already calls ngrok.disconnect() for current tunnel - whatif_comet_local.py: Remove global ngrok.kill() from __del__; remove unused pyngrok import Co-authored-by: nik464 <nikhil18chaudhary@gmail.com>
Author
|
@microsoft-github-policy-service agree |
Renato L. de F. Cunha (renatolfc)
requested changes
Aug 22, 2026
Renato L. de F. Cunha (renatolfc)
left a comment
Contributor
There was a problem hiding this comment.
Thanks for addressing the hard-coded webhook port. We cannot merge this as-is: the ngrok tunnel and agent lifecycle are not cleaned up, pyngrok still uses shared mutable configuration across runs, and choosing a free port before binding it retains a TOCTOU race. Please rebase onto current main, use per-run scoped configuration, bind the port atomically, and guarantee cleanup on success and failure. Note that #199 is a separate COMET API v2.5 compatibility issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #228
Problem
The Carbon Sequestration notebook fails when run more
than once simultaneously because:
crashes with "port already in use"
belonging to other running instances
Fix
find_free_port() that binds to port 0 to get an
OS-assigned available port
for per-server port isolation
finally block — server.shutdown() already calls
ngrok.disconnect() for current tunnel only
from del and remove unused pyngrok import
Files Changed
Validation
Co-authors
Co-authored-by: nik464 nikhil18chaudhary@gmail.com