matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.74k stars 676 forks source link

Update NATS to 2.10.20, use `SyncAlways` #3418

Closed neilalexander closed 2 months ago

neilalexander commented 2 months ago

The internal NATS instance is definitely convenient but it does have one problem: its lifecycle is tied to the Dendrite process. That means if Dendrite panics or OOMs, it takes out NATS with it. I suspect this is sometimes contributing to what people see with stuck streams, as some operations or state might not be written to disk fully before it gets interrupted.

Using SyncAlways means that NATS will effectively use O_SYNC and block writes on flushes, which should improve resiliency against this kind of failure considerably. It might affect performance a little but shouldn't be significant.

Also updates NATS to 2.10.20 as there have been all sorts of fixes since 2.10.7, including better SyncAlways handling.

Signed-off-by: Neil Alexander git@neilalexander.dev

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 68.19%. Comparing base (7a4ef24) to head (2459fd2). Report is 3 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3418 +/- ## ========================================== - Coverage 68.20% 68.19% -0.01% ========================================== Files 513 513 Lines 47021 47022 +1 ========================================== - Hits 32070 32067 -3 - Misses 10952 10960 +8 + Partials 3999 3995 -4 ``` | [Flag](https://app.codecov.io/gh/matrix-org/dendrite/pull/3418/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/matrix-org/dendrite/pull/3418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org) | `53.31% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=matrix-org#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.