redis - actioncable connection lost immediately in production - Stack Overflow

Actioncable subscribe leads to this error in production:home[app].rbenvversionsjruby-9.4.1.0lib

Actioncable subscribe leads to this error in production:

/home/[app]/.rbenv/versions/jruby-9.4.1.0/lib/ruby/gems/shared/gems/actioncable-6.1.6.1/lib/action_cable/connection/stream_event_loop.rb:74

ArgumentError: mode not supported for this object: r
    register at /nio4r/Selector.java:122

It's working in development, and also locally in production. But, as I figured out, production on a external server has stricter requirements: 'identified_by :current_user' is necessary there.

As I don't think "importmaps" does help, I simply added the actioncable.js javascript file which would be imported with the extra additionally importmaps and attached it like a normal js file. This also works in development and locally in production, hence I assume the problem to be independent of that.

The last logfile entry is created at the end of:

application_cable/connect.rb

But in development the next log entry is: Registered connection (Z2lkOi8vcmVjbHVlL1VzZXIvMQ)

And in development I also can see, that module ApplicationCable class Channel gets called. But it doesn't in production.

Locally redis-cli monitor reports:

1741170206.642863 [1 127.0.0.1:60792] "select" "1"
1741170206.645384 [1 127.0.0.1:60792] "client" "setname" "ActionCable-PID-205601"
1741170206.646141 [1 127.0.0.1:60792] "subscribe" "_action_cable_internal"
1741170206.647203 [1 127.0.0.1:60792] "subscribe" "[app]_development:action_cable/Z2lkOi8vcmVjbHVlL1VzZXIvMw"
1741170206.648451 [1 127.0.0.1:60792] "subscribe" "[app]_development:messages_channel_3"

in production the last the final subscription is missing:

1741168655.771025 [1 127.0.0.1:34326] "SELECT" "1"
1741168655.771083 [1 127.0.0.1:34326] "CLIENT" "SETNAME" "ActionCable-PID-20413"
1741168655.772064 [1 127.0.0.1:34326] "subscribe" "_action_cable_internal"
1741168655.772582 [1 127.0.0.1:34326] "subscribe" "[app]_production:action_cable/Z2lkOi8vcmVjbHVlL1VzZXIvMQ

Next MessagesChannel def subscribed never gets called. What is 'object :r' ?

Anybody any clue? Thanks!

Actioncable subscribe leads to this error in production:

/home/[app]/.rbenv/versions/jruby-9.4.1.0/lib/ruby/gems/shared/gems/actioncable-6.1.6.1/lib/action_cable/connection/stream_event_loop.rb:74

ArgumentError: mode not supported for this object: r
    register at /nio4r/Selector.java:122

It's working in development, and also locally in production. But, as I figured out, production on a external server has stricter requirements: 'identified_by :current_user' is necessary there.

As I don't think "importmaps" does help, I simply added the actioncable.js javascript file which would be imported with the extra additionally importmaps and attached it like a normal js file. This also works in development and locally in production, hence I assume the problem to be independent of that.

The last logfile entry is created at the end of:

application_cable/connect.rb

But in development the next log entry is: Registered connection (Z2lkOi8vcmVjbHVlL1VzZXIvMQ)

And in development I also can see, that module ApplicationCable class Channel gets called. But it doesn't in production.

Locally redis-cli monitor reports:

1741170206.642863 [1 127.0.0.1:60792] "select" "1"
1741170206.645384 [1 127.0.0.1:60792] "client" "setname" "ActionCable-PID-205601"
1741170206.646141 [1 127.0.0.1:60792] "subscribe" "_action_cable_internal"
1741170206.647203 [1 127.0.0.1:60792] "subscribe" "[app]_development:action_cable/Z2lkOi8vcmVjbHVlL1VzZXIvMw"
1741170206.648451 [1 127.0.0.1:60792] "subscribe" "[app]_development:messages_channel_3"

in production the last the final subscription is missing:

1741168655.771025 [1 127.0.0.1:34326] "SELECT" "1"
1741168655.771083 [1 127.0.0.1:34326] "CLIENT" "SETNAME" "ActionCable-PID-20413"
1741168655.772064 [1 127.0.0.1:34326] "subscribe" "_action_cable_internal"
1741168655.772582 [1 127.0.0.1:34326] "subscribe" "[app]_production:action_cable/Z2lkOi8vcmVjbHVlL1VzZXIvMQ

Next MessagesChannel def subscribed never gets called. What is 'object :r' ?

Anybody any clue? Thanks!

Share Improve this question edited Mar 5 at 11:17 Theores asked Mar 4 at 13:33 TheoresTheores 236 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

it's a bug.

But the situation causing it can be avoided by using tcp instead of unix for upstream:

config/puma.rb

bind "unix://#{shared_dir}/sockets/puma.sock"

has to be

bind "tcp://0.0.0.0:9292"

nginx/conf/nginx.conf

upstream app {
    server unix:///var/www/reclue/shared/sockets/puma.sock fail_timeout=0;
}

has to be

upstream app {
    server 0.0.0.0:9292;
}

all problems of instability, like they are described in several discussions, disappear. In addition this proves that importmaps is not making anything better. So avoid making things more complicated and simply import js-files directly.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745040925a4607800.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信