Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Unexpected exception on redis disconnect Redis - NoMethodError(undefined method `destroy' for nil:NilClass)

未關閉
#362 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
rails, redis, ruby
領域
backend

研究方向

從 ruby/hyper-operation/transport/connection_adapter/redis.rb 第 66 行開始,然後閱讀經過 connection.rb 和 action_cable.rb 的 disconnect 呼叫鏈。追蹤 Redis 中斷連線路徑為何會在 nil 上呼叫 destroy;完成標準是中斷 channel 的連線不再引發所回報的 NoMethodError。

由索引模型根據 Issue 內容生成。

描述

I switched recently to the new Redis message functionality and I get the following exception in production.log

I, [2021-02-25T14:13:45.826641 #1289]  INFO -- : Finished "/cable/" [WebSocket] for 127.0.0.1 at 2021-02-25 14:13:45 +0200
I, [2021-02-25T14:13:45.830986 #1289]  INFO -- : Hyperstack::ActionCableChannel stopped streaming from hyperstack-AnnouncementCategory
I, [2021-02-25T14:13:45.926758 #1266]  INFO -- : Finished "/cable/" [WebSocket] for 127.0.0.1 at 2021-02-25 14:13:45 +0200
I, [2021-02-25T14:13:45.933053 #1266]  INFO -- : Hyperstack::ActionCableChannel stopped streaming from hyperstack-AnnouncementCategory
I, [2021-02-25T14:13:46.010028 #1266]  INFO -- : Hyperstack::ActionCableChannel stopped streaming from hyperstack-Epos::Applicant-423783
I, [2021-02-25T14:13:46.028519 #1266]  INFO -- : Hyperstack::ActionCableChannel stopped streaming from hyperstack-Hyperstack::Session-e570d5777171d6ae432a94fef3735d11
E, [2021-02-25T14:13:46.159163 #1289] ERROR -- : There was an exception - NoMethodError(undefined method `destroy' for nil:NilClass)
E, [2021-02-25T14:13:46.162694 #1289] ERROR -- : /home/app/shared/bundle/ruby/2.7.0/bundler/gems/hyperstack-f07d016b626a/ruby/hyper-operation/lib/hyper-operation/transport/connection_adapter/redis.rb:66:in `disconnect'
/home/app/shared/bundle/ruby/2.7.0/bundler/gems/hyperstack-f07d016b626a/ruby/hyper-operation/lib/hyper-operation/transport/connection.rb:68:in `disconnect'
/home/app/shared/bundle/ruby/2.7.0/bundler/gems/hyperstack-f07d016b626a/ruby/hyper-operation/lib/hyper-operation/transport/action_cable.rb:36:in `unsubscribed'

I had the same problem when using the db message store and back then i had to patch hyperstack.rb initializer with the following patch from @catmando :

module Hyperstack
  class Connection < ActiveRecord::Base
    def self.disconnect(channel)
      puts "\ndisconnecting from #{channel}\n" if Rails.env.development?
      c = find_by(channel: channel, session: nil)
      if c
        c.destroy
      else
        puts "\n********************** WARNING #{channel} has not been opened.  Why are we disconnecting ?????????? \n"
      end
    end
  end
end

Why is this happeing?

主要語言
JavaScript
星號
538
分支
41
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

hyperstack-org/hyperstack 的其他 Issue

查看 hyperstack-org/hyperstack 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。