Skip to content

Allow the homeserver to finish partial-state joining before teardown#570

Merged
squahtx merged 1 commit into
mainfrom
squah/faster_room_joins_fix_cleanup
Dec 13, 2022
Merged

Allow the homeserver to finish partial-state joining before teardown#570
squahtx merged 1 commit into
mainfrom
squah/faster_room_joins_fix_cleanup

Conversation

@squahtx

@squahtx squahtx commented Dec 12, 2022

Copy link
Copy Markdown
Contributor

Since the partial state join tests reuse the same homeserver deployment,
it is important that each test leaves the homeserver in an acceptable
state for subsequent tests. In particular, we must allow in-progress
partial-state joins to complete before tearing down Complement servers,
otherwise the homeserver may mark Complement hostname:port combinations
as offline and refuse to contact them in subsequent tests.


These issues have 502 Bad Gateway failures:
Closes matrix-org/synapse#13564.
Closes matrix-org/synapse#14245.
Closes matrix-org/synapse#14543.

Since the partial state join tests reuse the same homeserver deployment,
it is important that each test leaves the homeserver in an acceptable
state for subsequent tests. In particular, we must allow in-progress
partial-state joins to complete before tearing down Complement servers,
otherwise the homeserver may mark Complement hostname:port combinations
as offline and refuse to contact them in subsequent tests.
@squahtx
squahtx requested review from a team as code owners December 12, 2022 21:59

@DMRobertson DMRobertson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this means we now automatically call awaitPartialStateJoinCompletion via defer. We were already doing so in some places. Is there any danger in doing so again? (I think not: we just recheck that Synapse has fully joined by calling /members?)

@squahtx

squahtx commented Dec 13, 2022

Copy link
Copy Markdown
Contributor Author

I think this means we now automatically call awaitPartialStateJoinCompletion via defer. We were already doing so in some places. Is there any danger in doing so again? (I think not: we just recheck that Synapse has fully joined by calling /members?)

It should be fine. There are no side effects apart from taking extra time.

@squahtx
squahtx merged commit 94b75d8 into main Dec 13, 2022
@squahtx
squahtx deleted the squah/faster_room_joins_fix_cleanup branch December 13, 2022 12:55
@squahtx squahtx self-assigned this Dec 15, 2022
MadLittleMods added a commit that referenced this pull request Jul 21, 2026
Follow-up to #894 which removes another part of the clean-up code in this file and #880 which introduces a better way to avoid the test pollution and obsoletes the need for all of this cleanup logic. See the PR description there for a more complete context on why.

`Destroy(...)` was originally introduced in this context:

> Since the partial state join tests reuse the same homeserver deployment, it is important that each test leaves the homeserver in an acceptable state for subsequent tests. In particular, we must allow in-progress partial-state joins to complete before tearing down Complement servers, otherwise the homeserver may mark Complement `hostname:port` combinations as offline and refuse to contact them in subsequent tests.
>
> *-- #570

But thanks to #880 we no longer use the same `hostname:port` for engineered homeservers anymore.

---

Given the nature of these changes, this also fixes the goroutine panic that can happen when the waiter finishes after the test and `t` is used after the test finishes, see #894 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants