fix: add timeout to registry URL validation to prevent indefinite hang#2082
fix: add timeout to registry URL validation to prevent indefinite hang#2082Islam0953 wants to merge 1 commit intoasyncapi:masterfrom
Conversation
|
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.
… hang When --registry-url points to an unreachable host, the CLI hangs forever because fetch() has no timeout. Add AbortController with 10s timeout, switch to HEAD method, and provide distinct error messages for timeout vs other network failures. Closes asyncapi#2027 https://claude.ai/code/session_01K5UYcnS3skK6SKhFz3dcZs
37e0347 to
1b45ce1
Compare
|



Description
Fixes #2027
The
registryValidation()function callsfetch(registryUrl)with no timeout. When the URL points to an unreachable host (e.g., a black-holed IP like10.255.255.1), the CLI hangs indefinitely waiting for the OS-level TCP timeout.Changes
AbortControllerwith 10-second timeout to thefetchcall inregistryValidation()GETtoHEAD(only need to check reachability, not download body)finallyblock to clean up the timerHow it works
Testing
Tested with unreachable host — CLI now fails after 10 seconds with a clear error message instead of hanging indefinitely.