Project

General

Profile

Actions

バグ #1342

closed

mastodonプラグイン: 長時間放置すると落ちる

Added by cob odo over 5 years ago. Updated over 5 years ago.

Status:
終了
Priority:
通常
Assignee:
Target version:
プラグイン名:
mastodon
クラッシュする:
Yes

Description

低確率で発生するのだと思います。
mastodonプラグインの挙動の問題なのか、atomicの問題なのか、weakstorageの問題なのかはよくわかりません。


再現手順

(おそらく何らかのMastodon Worldを登録した状態で?)長時間放置する。
クラッシュ時のエラーメッセージは以下の通り。

/home/cobodo/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize': can't add a new key into hash during iteration (RuntimeError)
from /home/cobodo/repos/mikutter/core/lib/weakstorage.rb:29:in `atomic'
from /home/cobodo/repos/mikutter/core/lib/weakstorage.rb:195:in `[]='
from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:164:in `merge_or_create'
from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:117:in `json2status'
from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:96:in `block in build'
from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:95:in `map'
from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:95:in `build'
from /home/cobodo/repos/mikutter/core/plugin/mastodon_sse_streaming/mastodon_sse_streaming.rb:384:in `update_handler'
from /home/cobodo/repos/mikutter/core/plugin/mastodon_sse_streaming/mastodon_sse_streaming.rb:229:in `block (2 levels) in <top (required)>'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/listener.rb:25:in `call'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:116:in `block (2 levels) in call_all_listeners'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:115:in `each'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:115:in `block in call_all_listeners'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:114:in `catch'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:114:in `call_all_listeners'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:42:in `block in call'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer/procedure.rb:24:in `run'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer/extend.rb:58:in `run_once'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer/extend.rb:30:in `run'
from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer.rb:43:in `method_missing'
from /home/cobodo/repos/mikutter/core/plugin/gtk/delayer.rb:10:in `block in boot'
from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:7:in `main'
from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:7:in `block in mainloop'
from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:6:in `loop'
from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:6:in `mainloop'
from ./mikutter.rb:69:in `boot!'
from ./mikutter.rb:105:in `<main>'

Actions #1

Updated by toshi_a 初音 over 5 years ago

  • Status changed from 分類待ち to 実装待ち

同様の問題がちょくちょく報告されています。
WeakStorageは内部で使っている @_storage には外からアクセスしないので、この問題が起こるということはWeakStorageの実装に問題がありそうです。
しかしTwitterなどでもこれが使われているので、問題は思い当たりません。

Actions #2

Updated by toshi_a 初音 over 5 years ago

  • Status changed from 実装待ち to レビュー待ち
  • Assignee set to cob odo
  • ブランチ set to topic/1342-weak-store-add-during-iteration

こういうこと(0efbfdc1)なんじゃないかなぁと思うんですが、どう思いますか

Actions #3

Updated by toshi_a 初音 over 5 years ago

今度は値をWeakStorageから取り出すときにtype_strictでエラーが発生するようになったので、原因となった値をもう少し丁寧に解析できるような感じにしてみた。
多分オブジェクト開放時にObjectSpaceのコールバックが正しく呼ばれておらず、同じobject idが全く違うオブジェクトに再利用されたのだと思う。

Actions #4

Updated by toshi_a 初音 over 5 years ago

この問題、多くの人に試用してもらって情報を集める他ないので、一度developにmergeしますが、調査は引き続き行います。

Actions #5

Updated by cob odo over 5 years ago

次のエラーです。ご査収ください(エラー送信ダイアログ表示されず)

/home/cobodo/repos/mikutter/core/utils.rb:214:in `each': The #0 value does not matched constraint `Plugin::Mastodon::Status' (TypeStrictError)
    from /home/cobodo/repos/mikutter/core/utils.rb:214:in `with_index'
    from /home/cobodo/repos/mikutter/core/utils.rb:214:in `type_strict'
    from /home/cobodo/repos/mikutter/core/lib/weakstorage.rb:186:in `[]'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:158:in `merge_or_create'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:117:in `json2status'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:96:in `block in build'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:95:in `map'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:95:in `build'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon_sse_streaming/mastodon_sse_streaming.rb:384:in `update_handler'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon_sse_streaming/mastodon_sse_streaming.rb:229:in `block (2 levels) in <top (required)>'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/listener.rb:25:in `call'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:116:in `block (2 levels) in call_all_listeners'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:115:in `each'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:115:in `block in call_all_listeners'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:114:in `catch'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:114:in `call_all_listeners'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/pluggaloid-1.1.2/lib/pluggaloid/event.rb:42:in `block in call'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer/procedure.rb:24:in `run'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer/extend.rb:58:in `run_once'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer/extend.rb:30:in `run'
    from /home/cobodo/repos/mikutter/vendor/bundle/ruby/2.6.0/gems/delayer-0.0.2/lib/delayer.rb:43:in `method_missing'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/delayer.rb:10:in `block in boot'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:7:in `main'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:7:in `block in mainloop'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:6:in `loop'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:6:in `mainloop'
    from ./mikutter.rb:69:in `boot!'
    from ./mikutter.rb:105:in `<main>'
Actions #6

Updated by cob odo over 5 years ago

別の経路からのエラーです。

/home/cobodo/repos/mikutter/core/utils.rb:216:in `block in type_strict': The #0 value does not matched constraint `Plugin::Mastodon::Account' (TypeStrictError)
    from /home/cobodo/repos/mikutter/core/utils.rb:214:in `each'
    from /home/cobodo/repos/mikutter/core/utils.rb:214:in `with_index'
    from /home/cobodo/repos/mikutter/core/utils.rb:214:in `type_strict'
    from /home/cobodo/repos/mikutter/core/lib/weakstorage.rb:186:in `[]'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/account.rb:103:in `findbyacct'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:280:in `block in retweeted_by'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:280:in `map'
    from /home/cobodo/repos/mikutter/core/plugin/mastodon/model/status.rb:280:in `retweeted_by'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_share.rb:18:in `get_default_votes'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_voter.rb:14:in `initialize'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_helper.rb:22:in `new'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_helper.rb:22:in `block in subparts'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_helper.rb:22:in `map'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_helper.rb:22:in `subparts'
    from /home/cobodo/repos/mikutter/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_helper.rb:42:in `_subparts_height'
    from /home/cobodo/repos/mikutter/core/mui/cairo_sub_parts_helper.rb:35:in `subparts_height'
    from /home/cobodo/repos/mikutter/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
    from /home/cobodo/repos/mikutter/core/mui/cairo_coordinate_module.rb:49:in `height'
    from /home/cobodo/repos/mikutter/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
    from /home/cobodo/repos/mikutter/core/mui/cairo_cell_renderer_message.rb:145:in `render_message'
    from /home/cobodo/repos/mikutter/core/mui/cairo_cell_renderer_message.rb:128:in `uri='
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:7:in `main'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:7:in `block in mainloop'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:6:in `loop'
    from /home/cobodo/repos/mikutter/core/plugin/gtk/mainloop.rb:6:in `mainloop'
    from ./mikutter.rb:69:in `boot!'
    from ./mikutter.rb:105:in `<main>'
Actions #7

Updated by toshi_a 初音 over 5 years ago

  • Status changed from レビュー待ち to 実装待ち
  • Assignee changed from cob odo to toshi_a 初音

cob odo さんは書きました:

別の経路からのエラーです。

[...]

ありがとうございます。 #1342-4 のバックトレースは #1342-5#1342-6 と同じです。これだけ方針を決めれば解決ですね。

Actions #8

Updated by toshi_a 初音 over 5 years ago

  • Status changed from 実装待ち to レビュー待ち
  • Assignee changed from toshi_a 初音 to cob odo

WeakRefのコードを読んだところ、そちらのほうがObjectSpaceを使うよりも筋が良さそうだったので、WeakStorageの内部実装を変更しました。

Actions #9

Updated by toshi_a 初音 over 5 years ago

developにmergeしました。これで使ってみてレビューしてください。

Actions #10

Updated by cob odo over 5 years ago

ありがとうございます。今日の午後は1時間おきに落ちているような始末でしたが今は安定しているように見受けられます。
1~2日様子を見てみます。

Actions #11

Updated by cob odo over 5 years ago

  • Status changed from レビュー待ち to 終了

丸2日落ちなかったので大丈夫そうです。すでにdevelopにマージ済みですので、終了にしておきますね。

Actions

Also available in: Atom PDF