Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can be the reason of "Unable to find subscription with identifier" in Rails ActionCable?

I'm building a messenger application using Rails 5.0.0.rc1 + ActionCable + Redis.

I've single channel ApiChannel and a number of actions in it. There are some "unicast" actions -> ask for something, get something back, and "broadcast" actions -> do something, broadcast the payload to some connected clients.

From time to time I'm getting RuntimeError exception from here: https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/connection/subscriptions.rb#L70 Unable to find subscription with identifier (...).

What can be a reason of this? In what situation can I get such exception? I spent quite a lot of time on investigating the issue (and will continue to do so) and any hints would be greatly appreciated!

like image 642
Tomek Wałkuski Avatar asked Jun 08 '16 07:06

Tomek Wałkuski


1 Answers

It looks like it's related to this issue: https://github.com/rails/rails/issues/25381

Some kind of race conditions when Rails reply the subscription has been created but in fact it hasn't been done yet.

As a temporary solution adding a small timeout after establishing the subscription has solved the issue.

More investigation needs to be done, though.

like image 190
Tomek Wałkuski Avatar answered Oct 12 '22 01:10

Tomek Wałkuski