Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#362 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
rails, redis, ruby
Ambito
backend

Direzione di ricerca

Inizia dalla riga 66 di ruby/hyper-operation/transport/connection_adapter/redis.rb, quindi leggi la catena di chiamate di disconnect attraverso connection.rb e action_cable.rb. Traccia il motivo per cui il percorso di disconnessione di Redis arriva a destroy su nil; il lavoro è completato quando la disconnessione di un channel non solleva più il NoMethodError segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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?

Lingua principale
JavaScript
Stelle
538
Fork
41
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hyperstack-org/hyperstack

Tutte le issue di hyperstack-org/hyperstack

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.