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

Can't react with custom emoji リアクションできない #10502

Closed
tamaina opened this issue Apr 7, 2023 · 32 comments · Fixed by #10529
Closed

Can't react with custom emoji リアクションできない #10502

tamaina opened this issue Apr 7, 2023 · 32 comments · Fixed by #10529
Labels
🐛Bug Unexpected behavior packages/backend Server side specific issue/PR

Comments

@tamaina
Copy link
Member

tamaina commented Apr 7, 2023

リアクションしようとしてもできない

TypeError: JSON.parse(...).map is not a function
    at RedisSingleCache.fromRedisConverter (file:///home/misskey/misskey/packages/backend/built/core/CustomEmojiService.js:285:68)
    at RedisSingleCache.get (file:///home/misskey/misskey/packages/backend/built/misc/cache.js:129:21)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async RedisSingleCache.fetch (file:///home/misskey/misskey/packages/backend/built/misc/cache.js:138:29)
    at async ReactionService.toDbReaction (file:///home/misskey/misskey/packages/backend/built/core/ReactionService.js:256:50)
    at async ReactionService.create (file:///home/misskey/misskey/packages/backend/built/core/ReactionService.js:76:24)
    at async file:///home/misskey/misskey/packages/backend/built/server/api/endpoints/notes/reactions/create.js:76:13
    at async ApiCallService.call (file:///home/misskey/misskey/packages/backend/built/server/api/ApiCallService.js:275:16) f4a067a1-4b39-46e8-99b8-8a17aa033c65
@tamaina tamaina added the ⚠️bug? This might be a bug label Apr 7, 2023
@tamaina
Copy link
Member Author

tamaina commented Apr 7, 2023

image

@syuilo
Copy link
Member

syuilo commented Apr 7, 2023

@tamaina
Copy link
Member Author

tamaina commented Apr 7, 2023

何もしてないけどなおった

@tamaina tamaina closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2023
@tamaina tamaina reopened this Apr 8, 2023
@tamaina
Copy link
Member Author

tamaina commented Apr 8, 2023

うーん、また発生した

@fu-sen
Copy link

fu-sen commented Apr 8, 2023

13.11.0 のサーバーでこの問題を確認できています。分かっている事として
Unicode 絵文字でリアクション可能、カスタム絵文字はリアクションできない状態です。

@fu-sen
Copy link

fu-sen commented Apr 8, 2023

13.11.0 へ更新したサーバーのローカル内だけ不具合の対象で、
連合からのリアクションはカスタム絵文字も表示できてます。

@tamaina tamaina added 🐛Bug Unexpected behavior packages/backend Server side specific issue/PR and removed ⚠️bug? This might be a bug labels Apr 8, 2023
@tamaina tamaina changed the title リアクションできない Can't react with custom emoji リアクションできない Apr 8, 2023
@tamaina
Copy link
Member Author

tamaina commented Apr 8, 2023

調べるか〜

@fu-sen
Copy link

fu-sen commented Apr 8, 2023

サーバーによっては正常なところもあるのを確認しました。

@tamaina
Copy link
Member Author

tamaina commented Apr 8, 2023

localEmojisが(empty array)の時は{}が返ってくるっぽい?

@syuilo
Copy link
Member

syuilo commented Apr 8, 2023

image

localEmojisというキーで保存されているわけではないのでこれは正しいことは注意
(実際はsinglecache:localEmojis)

@syuilo
Copy link
Member

syuilo commented Apr 8, 2023

ローカルではどうやっても再現しないし謎過ぎる

@fu-sen
Copy link

fu-sen commented Apr 9, 2023

不具合が出るサーバーで、その後確認した限りでは、
リアクションできる時と、リアクションしても反応しない時がありました。
タイミングがよくわかりません。

syuilo added a commit that referenced this issue Apr 9, 2023
* fix(server): リアクションできない問題をとりあえず修正
Fix #10502

* Update packages/backend/src/core/CustomEmojiService.ts

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
@Mogyuchi
Copy link

Mogyuchi commented Apr 9, 2023

お茶濁し修正でこのissue閉じちゃっているけれどそれで良いのか疑問

@tamaina
Copy link
Member Author

tamaina commented Apr 9, 2023

とりあえず動くし…

(原因調べたければごゆっくりどうぞという感じ

@okaits
Copy link

okaits commented Apr 9, 2023

13.11.0の当サーバーでも同じ問題が発生しました。
時間を置くとできることもありますが、高確率で同じ問題が発生するようです。ローカル/リモート関係なく発生しています。

@fu-sen
Copy link

fu-sen commented Apr 9, 2023

13.11.1 で解決しているように見えます。アップデートして下さい。

@okaits
Copy link

okaits commented Apr 9, 2023

アップデートしました。ありがとうございました!

@Chimorium
Copy link
Contributor

素人ですがすみません。13.11.1の環境(VPS上)で、本件の修正箇所だけ修正前の状態に戻して調査しました。

systemctl restart misskey

で再起動すると、カスタム絵文字でのリアクションが出来ない状態となり、
そのまま30分程度放置しておくと、リアクションが出来るようになりました。

このツリーで言及されている、Redisのキーについてですが、
リアクションが出来ない間は

127.0.0.1:6379> get "example.tld:singlecache:localEmojis"
"{}"

と返ってきました。それが、リアクションができる状態になったとき、

127.0.0.1:6379> get "example.tld:singlecache:localEmojis"
(nil)
127.0.0.1:6379> keys "example.tld:singlecache:localEmojis"
(empty array)

に変わっていました。そして、実際にリアクションをした後になると、

127.0.0.1:6379> get "example.tld:singlecache:localEmojis"
"{}"

になっていました。それ以降はそのまま問題なくリアクションできています。

内部処理が全く分からないためこれ以上のことを述べられないのですが、
将来的に一助にもなればと思い、初めてコメントさせていただきました。
(これを踏まえて結局今回の修正で合っているということになりましたら、すみません)

@shibaobun
Copy link
Contributor

Hello, I just wanted to say that I was having this issue on 13.11.0 at misskey.bubbletea.dev and updating to 13.11.1 immediately fixed it

@Chimorium
Copy link
Contributor

127.0.0.1:6379> get "example.tld:singlecache:localEmojis"
"{}"

になっていました。それ以降はそのまま問題なくリアクションできています。

上記、誤りがありました。3分間はリアクション出来るのですが、その後は30分程度リアクション出来なくなります。

原因を深く調査したところ、以下のように処理が進んでいると分かりました。

  • Redisのキー"example.tld:singlecache:localEmojis"が存在しないとする。このときはリアクション出来る。
  • リアクションを行うと、Redisの上記キーに不正な値"{}"が登録される。ただし、3分間はメモリキャッシュが使われるため、問題なくリアクション出来る。
  • 3分経過すると、上記不正な値の影響でリアクションが出来なくなる。
  • 30分経過すると、lifetimeを終えて上記キーが削除される。
  • 以下繰り返し。
  • Redisを再起動したときは前回値が入っているため、不正な値が入った状態の場合はリアクション出来ないことになる。

それではどうして不正な値が登録されているのか、色々調べたところ、JSON.stringifyの引数にMapIteratorが入ると、"{}"という結果になってしまうことが分かりました。
これを修正する形で、プルリクエストを出させていただきたいと思います。

長々とコメント失礼いたしました。

@nexryai
Copy link
Contributor

nexryai commented Apr 11, 2023

13.11.2で再び発生しています

@syuilo
Copy link
Member

syuilo commented Apr 11, 2023

Redisに古いキャッシュが残っている影響かも

@tamaina
Copy link
Member Author

tamaina commented Apr 11, 2023

Redisのキャッシュをパージってできるの

@nexryai
Copy link
Contributor

nexryai commented Apr 11, 2023

redis-cliからdel example.com:singlecache:localEmojisしたらリアクションできるようになりました

@syuilo
Copy link
Member

syuilo commented Apr 11, 2023

Misskeyからの操作としてはできない
あと全パージは通知とかも消えるから不便そう

@tamaina
Copy link
Member Author

tamaina commented Apr 11, 2023

del example.com:singlecache:localEmojis

redis-cliとか経由でいいのか

@nexryai
Copy link
Contributor

nexryai commented Apr 11, 2023

redis-cliで入って実行しました

@tamaina
Copy link
Member Author

tamaina commented Apr 11, 2023

xargs使えばいい感じに処理できる感じがある

https://blog.morugu.com/entry/2018/01/06/233402

@tar-bin
Copy link
Contributor

tar-bin commented Apr 11, 2023

13.11.2アップデート後に同様の症状出ましたが、自分も以下の対処で症状治りました。
(redis-cliで<domain>:singlecache:localEmojisをdel)

$ sudo docker exec -i -t <redis container id> /bin/sh
/data # redis-cli
127.0.0.1:6379> get example.com:singlecache:localEmojis
"{}"
127.0.0.1:6379> del example.com:singlecache:localEmojis
(integer) 1
127.0.0.1:6379> get example.com:singlecache:localEmojis
(nil)

@HEPPy4869
Copy link

13.11.2においてredis-cliでの操作は行ったのですが,カスタム絵文字でリアクションを行うと以下のようなエラーが発生してリアクションできないことがあります.(時間を空けると正常にリアクションできる場合もある)

{
  ep: 'notes/reactions/create',
  ps: { noteId: '9dgu01sgoq', reaction: ':test:', i: 'Di7EY8y95ZnkH5Ih' },
  e: {
    message: 'emoji.updatedAt.toISOString is not a function',
    code: 'TypeError',
    stack: 'TypeError: emoji.updatedAt.toISOString is not a function\n' +
      '    at ApRendererService.renderEmoji (file:///misskey/packages/backend/built/core/activitypub/ApRendererService.js:143:64)\n' +
      '    at ApRendererService.renderLike (file:///misskey/packages/backend/built/core/activitypub/ApRendererService.js:226:22)\n' +
      '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
      '    at async ReactionService.create (file:///misskey/packages/backend/built/core/ReactionService.js:147:63)\n' +
      '    at async file:///misskey/packages/backend/built/server/api/endpoints/notes/reactions/create.js:76:13\n' +
      '    at async ApiCallService.call (file:///misskey/packages/backend/built/server/api/ApiCallService.js:275:16)',
    id: '0a5a2a0c-1754-4006-9324-54bdad63f479'
  }
}

@syuilo
Copy link
Member

syuilo commented Apr 12, 2023

直します

@syuilo
Copy link
Member

syuilo commented Apr 12, 2023

done d06d1e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Unexpected behavior packages/backend Server side specific issue/PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants