faye-rails icon indicating copy to clipboard operation
faye-rails copied to clipboard

undefined method `pop' for nil:NilClass

Open clairezed opened this issue 8 years ago • 3 comments

  • ruby 2.1.2
  • rails '4.1.6'
  • faye-rails 2.0.0

With no identified reason and inconsistently, this error is raised once or twice a day, for an app in production, by two lines of an app in production. One of the line is called from a background task, the other isn't.

These 2 lines are refers to a version of FayeRails::Controller.publish(), that raises an error directly in eventmachine :

extract from eventmachine code

def set_deferred_status status, *args
      cancel_timeout
      @errbacks ||= nil
      @callbacks ||= nil
      @deferred_status = status
      @deferred_args = args
      case @deferred_status
      when :succeeded
        if @callbacks
          while cb = @callbacks.pop # This line raises the error =========
            cb.call(*@deferred_args)
          end
        end
        @errbacks.clear if @errbacks
      when :failed
        if @errbacks
          while eb = @errbacks.pop
            eb.call(*@deferred_args)
          end
        end
        @callbacks.clear if @callbacks
      end
    end

How comes FayeRails::Controller could have no @callbacks ? Have you met this before ?

It may be linked with my comment on #73 as it raises also on FayeRails::Controller.publish()

clairezed avatar Jun 03 '16 15:06 clairezed

Clairezed, did you ever solve this? It's just started appearing for me.

gwynm avatar Feb 27 '17 06:02 gwynm

@clairezed @gwynm also seeing this issue, did you guys get anywhere with it? I expect it's some kind of threading edge case but will investigate further.

tombeynon avatar Jul 06 '17 13:07 tombeynon

Same thing.

ohmycto avatar Aug 09 '17 14:08 ohmycto