fix: add timeout to registry validation to prevent indefinite hang#2054
fix: add timeout to registry validation to prevent indefinite hang#2054chengyixu wants to merge 2 commits intoasyncapi:masterfrom
Conversation
…syncapi#2027) - Add AbortController with 5-second timeout to registryValidation() - Switch from GET to HEAD for lightweight registry reachability check - Provide specific error messages for timeout vs general network failure - Clean up timer in finally block to prevent memory leaks - Add comprehensive unit tests for all failure scenarios Fixes asyncapi#2027
🦋 Changeset detectedLatest commit: 46f3225 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
|
Hi team! Just checking in — all CI checks are passing (including SonarCloud Quality Gate) and the PR is mergeable. Would appreciate a review when you get a chance. Happy to address any feedback. Thanks! |
|
Hi team! Checking in — CI is passing and the fix is ready. Happy to make any changes needed to get this merged. Thanks! |
|
Hi @asyncapi/cli-maintainers! This PR has been open for a few days with CI passing. The fix addresses the registry timeout issue (#2027). Would love to get a review when you have a moment. Happy to make any adjustments needed! |
|
Friendly ping — CI still passing, happy to rebase or address any feedback! |
|
Hi! Just a friendly check-in — CI is still passing. Ready to make any adjustments for merge. Thanks! |
|
Hi @asyncapi/cli-maintainers! Friendly ping — PR #2054 adds a timeout to registry validation to prevent indefinite hangs. All 7 CI checks passing, SonarCloud green. This has been open since 2026-03-18. Would really appreciate a review. Thanks! |
|
Hi @asyncapi/cli-maintainers! Checking in on this fix — adds AbortController timeout to prevent indefinite CLI hang when --registry-url is unreachable. All 7 CI checks are passing (SonarCloud green, Lint PR title passed). The fix directly addresses issue #2027 which is part of the 2026-04 bounty program. Would love a review when you have a moment. Thanks! |
|
Hi @asyncapi/cli-maintainers! Checking in — this PR adds an AbortController timeout (5s) to prevent indefinite CLI hang when This directly addresses issue #2027 which is part of the 2026-04 Bounty Program (#2039). There are several competing PRs for the same issue — I'd love to hear if there's any specific feedback that would make this one the preferred fix. Happy to adjust the timeout duration, add tests, or make any other changes. Thanks! |



Summary
AbortControllerwith 5-second timeout toregistryValidation()to prevent CLI from hanging indefinitely when--registry-urlpoints to an unreachable hostGETtoHEADfor lightweight registry reachability checkfinallyblock to prevent memory leaksRoot Cause
registryValidation()insrc/utils/generate/registry.tscalledfetch(registryUrl)without any timeout orAbortController. When targeting an unreachable host (e.g.,10.255.255.1), the TCP connection hangs indefinitely, blocking the CLI and stalling CI pipelines.Changes
src/utils/generate/registry.ts:AbortControllerwith 5s timeoutGET→HEAD(lighter validation, only checks reachability)finallyblock for timer cleanuptest/unit/utils/registry.test.ts(new):Test Plan
asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template --registry-url http://10.255.255.1now fails in ~5s with clear errorFixes #2027