Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate unique room IDs when creating rooms #491

Merged
merged 1 commit into from
Oct 6, 2022

Conversation

squahtx
Copy link
Contributor

@squahtx squahtx commented Oct 5, 2022

This ensures that room IDs are not re-used across tests, even if a
Complement server happens to re-use the same port as a previous one,
which reduces noise when searching through logs and prevents homeservers
from getting confused when multiple test cases re-use the same
homeserver deployment.


Fixes matrix-org/synapse#13975 together with #486.

This ensures that room IDs are not re-used across tests, even if a
Complement server happens to re-use the same port as a previous one,
which reduces noise when searching through logs and prevents homeservers
from getting confused when multiple test cases re-use the same
homeserver deployment.
@squahtx squahtx requested review from a team and kegsay as code owners October 5, 2022 18:43
Comment on lines +164 to +169
// Generate a unique room ID, prefixed with an incrementing counter.
// This ensures that room IDs are not re-used across tests, even if a Complement server happens
// to re-use the same port as a previous one, which
// * reduces noise when searching through logs and
// * prevents homeservers from getting confused when multiple test cases re-use the same homeserver deployment.
roomID := fmt.Sprintf("!%d-%s:%s", len(s.rooms), util.RandomString(18), s.serverName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever delete from or otherwise truncate s.rooms? Is it possible that some race could mean that we reuse a value of len(s.rooms)? (I have no idea what sort of concurrency problems one has to ancipate in Go.)

On second thought: we were using len(s.rooms) before, so this can't be any worse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever delete from or otherwise truncate s.rooms?

I did a search and can't find anywhere where we do that. I'd expect the random part of the room ID to handle conflicts with len(s.rooms) unless we are unlucky to the degree of ~1/2**107.

@squahtx squahtx merged commit 62ca6a6 into main Oct 6, 2022
@squahtx squahtx deleted the squah/unique_complement_room_ids branch October 6, 2022 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Complement flake(?) TestPartialStateJoin/* due to complement hostname:port re-use
3 participants