事象

起動直後は正常に動作しているMastodonストリーミングプロセスが、起動後数分たつとタイムラインが一切流れてこなくなる。

全ユーザーで再現する。

起動後数分待てば、再現率は100%。

切り分け状況

タイムラインが流れてこない状況でもClient〜Mastodonストリーミングプロセス間のTCP接続は切れておらず、あくまでwebsocket側の問題ではないと判断している。

タイムラインが流れてこなくなったタイミングで、mastodon-streamingプロセスおよびredis側には以下エラーが表示される(2/2で再現)。

## mastodon-streaming エラー

ERR! Redis Client Error! Error: read ECONNRESET
ERR! Redis Client Error!     at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
ERR! Redis Client Error!  Error: read ECONNRESET
ERR! Redis Client Error!     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
ERR! Redis Client Error!   errno: -104,
ERR! Redis Client Error!   code: 'ECONNRESET',
ERR! Redis Client Error!   syscall: 'read'
ERR! Redis Client Error! }

## Redisエラー
5450:M 29 Aug 2023 23:51:51.721 - Protocol error (unauth mbulk count) from client: id=502 addr=192.168.1.9:60128 fd=58 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=1122 qbuf-free=31646 argv-mem=0 obl=55 oll=0 omem=0 tot-mem=61440 events=r cmd=NULL user=default. Query buffer during protocol error: '*39..$9..SUBSCRIBE..$28..timeline:access_token:173941..$17..time' (... more 994 bytes ...) ':12034..$14..timeline:12034..$28..timeline:12034:notifications..'

そのため、mastodon-streamingプロセスとRedisの間の接続がうまくいっていないものと思われる。

環境

Ubuntu22.04

RedisとStreamingプロセスは別のサーバで動いている(VPCで接続されている)

Redisは apt で入れたもの(v=6.0.16)、StreamingプロセスはDockerで動いている(Mastodon 4.1.4)