acc: Use fixed ports instead of dynamically allocated ones for run-local tests#3490
Merged
andrewnester merged 5 commits intomainfrom Aug 27, 2025
Merged
acc: Use fixed ports instead of dynamically allocated ones for run-local tests#3490andrewnester merged 5 commits intomainfrom
andrewnester merged 5 commits intomainfrom
Conversation
Collaborator
24 failing tests:
|
6ce0f41 to
3518f4e
Compare
denik
reviewed
Aug 27, 2025
denik
approved these changes
Aug 27, 2025
Contributor
|
Thanks for looking into this! Should we remove allocate_ports.py as well? |
andrewnester
added a commit
that referenced
this pull request
Aug 28, 2025
…r run-local tests" (#3505) Reverts #3490 The tests still failing https://github.com/databricks/cli/actions/runs/17289620395/job/49073700178 ``` +++ /var/folders/x7/ch5v91h56_zbvbd1y2f600dm0000gn/T/TestAcceptcmdworkspaceappsrun-local1357262386/001/output.txt @@ -10,25 +10,6 @@ === Waiting === Checking app is running... >>> curl -s -o - http://127.0.0.1:$(port)/ -{ - "Accept": "*/*", - "Accept-Encoding": "gzip", - "Host": "127.0.0.1:$(port)", - "User-Agent": "curl/(version)", - "X-Forwarded-Email": "[USERNAME]", - "X-Forwarded-Host": "localhost", - "X-Forwarded-Preferred-Username": "", - "X-Forwarded-User": "[USERNAME]", - "X-Real-Ip": "127.0.0.1", - "X-Request-Id": "[UUID]" -} +jq: parse error: Invalid numeric literal at line 1, column 6 ```
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.
Changes
Use fixed ports instead of dynamically allocated ones for run-local tests
Why
After researching and trying to stabilize the tests, I concluded that dynamic port allocation is likely the root cause of its flakiness. The hypothesis is that
allocate_ports.pycalls socket.close() after finding a free port. When the socket is closed, the port it was using is released back to the OS. However, the port does not become instantly available for another application to use. It typically enters a TIME_WAIT state to handle any stray packets.It could be that the "connection refused" error, which happens when the curl command tries to connect after the Python script has closed the socket, but before the app has successfully bound to the port and is ready to accept connections
Tests
After making ports fixed in the script, all tests for all runners succeeded (tried 5 times)