Skip to content

Reduce port clashes in TestCluster - #6399

Merged
sergeybykov merged 6 commits into
dotnet:masterfrom
ReubenBond:fix/reduce-testcluster-port-clashes
Mar 14, 2020
Merged

sergeybykov merged 6 commits into
dotnet:masterfrom
ReubenBond:fix/reduce-testcluster-port-clashes

Conversation

@ReubenBond

Copy link
Copy Markdown
Member

This will not help as much on Linux, since named mutexes are only process-wide on Linux.
On Windows, this ought to work fairly well - we'll see 😅

@ReubenBond

Copy link
Copy Markdown
Member Author

I need to address some issues with this and perform some thread synchronization (yuck)

@ReubenBond
ReubenBond force-pushed the fix/reduce-testcluster-port-clashes branch from 4a9cc64 to a385227 Compare March 13, 2020 23:01
@ReubenBond
ReubenBond force-pushed the fix/reduce-testcluster-port-clashes branch from 0b6deba to aa95080 Compare March 14, 2020 19:03
@sergeybykov
sergeybykov merged commit fc1e0c4 into dotnet:master Mar 14, 2020
@ReubenBond
ReubenBond deleted the fix/reduce-testcluster-port-clashes branch March 15, 2020 00:18
sergeybykov pushed a commit that referenced this pull request Mar 24, 2020
@slonopotamus

Copy link
Copy Markdown

Why don't you just bind to port=0 and let OS guarantee you a free port? Present solution is full of race conditions and doesn't work reliably.

@ReubenBond

Copy link
Copy Markdown
Member Author

The current solution uses in-memory transports and doesn't bind to ports during tests, by default.

There is a reason why we also don't do what you're suggesting, though: the port is a part of the silos identity and it needs to know that before the bind occurs. Something different could work, but it would require significant changes.

@slonopotamus

Copy link
Copy Markdown

If tests are not binding to TCP ports, what's the point in TestClusterPortAllocator at all?

@ReubenBond

Copy link
Copy Markdown
Member Author

Tests don't bind to TCP ports by default. We have some tests which use the TestCluster which spawn hosts in separate processes or test socket logic. Those tests do use TCP ports.

@github-actions github-actions Bot locked and limited conversation to collaborators Dec 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants