mastodon.zunda.ninja is one of the many independent Mastodon servers you can use to participate in the fediverse.
Zundon is a single user instance as home of @zundan as well as a test bed for changes of the code.

Administered by:

Server stats:

1
active users

https://github.com/zunda/mastodon/commit/e865d53316717cfd73f43b438f78a090f66129d3 で仕懸けたログが何か記録していた。raw.inspectでStatusの配列が見えて、ordered_media_attachment_idsが0以上の要素の配列ではなくnilになっているStatusがあった。今回見えたのはid: 109843836637077109。

GitHubAdd logging to NoMethodError in cache_concern · zunda/mastodon@e865d53 Your self-hosted, globally interconnected microblogging community, zunda's fork - Add logging to NoMethodError in cache_concern · zunda/mastodon@e865d53
zunda

Papertrailでざっと検索したところ

NOt "ordered_media_attachment_ids: nil" "raw :["

で見つかる行は無かったのでordered_media_attachment_idsが空配列ではなくnilになっているのがエラーの原因と考えて良いだろう。

Postgresを覗くとid: 109843836637077109のstatusはordered_media_attachment_idsがNULLになっているのに対してひとつ前の要素のstatus (id: 109843832305808050)ではordered_media_attachment_idsに{}が入っていた。

NULLのstatusけっこうあるな。原因はこれじゃないかな。

> SELECT COUNT(1) FROM statuses WHERE created_at > '2023-02-11 02:30' AND created_at < '2023-02-11 03:00' AND ordered_media_attachment_ids IS NULL;
count
-------
187
(1 row)
> SELECT COUNT(1) FROM statuses WHERE created_at > '2023-02-11 02:30' AND created_at < '2023-02-11 03:00' AND ordered_media_attachment_ids IS NOT NULL;
count
-------
9
(1 row)

データベースのデータではなくキャッシュとのやりとりの時にどうしてだか化けるのかもしれない。

キャッシュといってもRailsのキャッシュじゃなくてタイムラインのキャッシュだね

idとupdated_atしかないStatusが並んでいるパターンも出現した。

NoMethodError (undefined method `fetch_value' for nil:NilClass):

app/controllers/concerns/cache_concern.rb:38:in `cache_collection'
app/controllers/api/v1/timelines/home_controller.rb:24:in `cached_home_statuses'
app/controllers/api/v1/timelines/home_controller.rb:20:in `load_statuses'
app/controllers/api/v1/timelines/home_controller.rb:9:in `show'
app/controllers/concerns/localized.rb:11:in `set_locale'
lib/mastodon/rack_middleware.rb:9:in `call'