You can add a custom Dip command to enable debugging capabilities: https://github.com/anycable/anycable_rails_demo/blob/c0b8ad885ddbe67209d0bb78cd661ac53ce81cbb/dip.yml#L44-L47
And then you run AnyCable as dip anycable
.
Hey! Looks like a reconnection feature of the Action Cable JS client: it assumes that a ping from server is received every 3s; if not it reconnects.
There is no way to change this interval in JS client.
You can try to tune the ping interval at the server side (make it smaller).
also, make sure you're using the latest version of AnyCable-go (at least 1.0.5)
Hello Team,
I would like to connect anycable in my Rails application to my Redis cluster hosted on AWS. When I wanted anycable to connect to a single Redis instance, I used the below configuration:
development:
redis_url: <Redis instance URL>
Would it be enough if I just replace the instance URL with the cluster URL? Will anycable have the intelligence to gather the multiple nodes in the cluster and connect to them all?
grpc
) or configured AnyCable.server_builder
yourself" and to resolve it I had to add grpc gem to my gemfile which is not needed in other production deployments and locally .
#12 295.7 compiling ./libsass/src/util_string.cpp
#12 295.7 compiling ./libsass/src/values.cpp
#12 295.7 linking shared-object sassc/libsass.so
#12 295.7 /usr/bin/ld: ast.o: no group info for section
#12 295.7 '.text._ZNK4Sass10VectorizedINS_10SharedImplINS_9StatementEEEE8elementsEv'
#12 295.7 /usr/bin/ld: ast.o: no group info for section
#12 295.7 '.text._ZNK4Sass10VectorizedINS_10SharedImplINS_9StatementEEEE8elementsEv'
#12 295.7 /usr/bin/ld: ast.o: no group info for section
#12 295.7 '.text._ZNK4Sass10VectorizedINS_10SharedImplINS_9StatementEEEE8elementsEv'
#12 295.7 /usr/bin/ld: ast.o: no group info for section
#12 295.7 '.text._ZNK4Sass10VectorizedINS_10SharedImplINS_9StatementEEEE8elementsEv'
#12 295.7 /usr/bin/ld: ast.o: file not recognized: bad value
#12 295.7 collect2: error: ld returned 1 exit status
#12 295.7 make: * [Makefile:262: libsass.so] Error 1
#12 295.7
#12 295.7 make failed, exit code 2
#12 295.7
#12 295.7 Gem files will remain installed in /usr/local/bundle/gems/sassc-2.4.0 for
#12 295.7 inspection.
#12 295.7 Results logged to
#12 295.7 /usr/local/bundle/extensions/x86_64-linux/3.0.0/sassc-2.4.0/gem_make.out
#12 295.7
#12 295.7 An error occurred while installing sassc (2.4.0), and Bundler cannot continue.
#12 295.7 Make sure that gem install sassc -v '2.4.0' --source 'https://rubygems.org/'
#12 295.7 succeeds before bundling.
#12 295.7
#12 295.7 In Gemfile:
#12 295.7 sass-rails was resolved to 6.0.0, which depends on
#12 295.7 sassc-rails was resolved to 2.1.2, which depends on
#12 295.7 sassc
executor failed running [/bin/sh -c bundle install]: exit code: 5
ERROR: Service 'anycable-rpc' failed to build : Build failed
Hello everyone. I'm facing some difficulties to config the service over here.
I'm running an app using Kubernetes. I've set the RPC deployment, the service and the Go server (all working well when I test using the rails console
).
The problem is when I call the url /cable
in my frontend application and the response is: No route matches [GET] "/cable"
.
I'm using the nonAcme
config in the helm chart
to set the path and host (same as the main rails app).
I'm probably messing around with some of these address.
Any clue?
Hi! For a moderate load (up to 5k), a single anycable-go instance would be enough; unless you restart them frequently and want to implement smth like rolling update, of course; in general, I would suggest choosing the pod size (e.g., resource limits) depending the overall cluster utilization; probably, deploying micro-pods wouldn’t be efficient, since you waste the idle RAM for each one.
Regarding RPCs, there are two things to consider: the idle app size (again, RAM) and the throughput.
For the second one, watch for rpc_pending metrics.
bundle exec anycable
) is invoked. Is it when a client sends a message through a socket (WS server invokes via gRPC the RPC server, which in turn invokes the application)? Or the other way around, when the application broadcasts a message through a socket?
bundle exec rails g anycable:setup
on an M1 mac/Users/john/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': dlopen(/Users/john/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/google-protobuf-3.18.0-universal-darwin/lib/google/2.7/protobuf_c.bundle, 9): no suitable image found. Did find: (LoadError)
"bundle exec anycable --rpc-host=0.0.0.0:50051 --http-health-port=54321 --http-health-path='/check'"
error: rpc error: code = desc = Received message larger than max (6994086 vs. 4194304)
Hi Palkan,
We use anycable for more than a year now. Websocket initiation happens only within logged-in pages. So ideally failed_auths_total metric should be 0. But recently we see huge numbers (3000-4000) everyday. (Used to be less than 50 in the inital days).
On investigating, we saw the following pattern of requests:
Sequence 1: Subscription happens and 1 message is sent to a channel every hour (Expected Behaviour)
D 2021-09-20T14:55:14.891Z context=node sid=P-75MnY-zka6bx0TH9Sfj websocket session established
D 2021-09-20T14:55:14.939Z context=node sid=P-75MnY-zka6bx0TH9Sfj Incoming message: &{subscribe {"channel":"AppearanceChannel",..} }
D 2021-09-20T14:55:14.939Z context=node sid=P-75MnY-zka6bx0TH9Sfj Incoming message: &{subscribe {"channel":"NotificationChannel",..} }
D 2021-09-20T15:55:15.469Z context=node sid=P-75MnY-zka6bx0TH9Sfj Incoming message: &{message {"channel":"AppearanceChannel"}... }
D 2021-09-20T16:55:15.469Z context=node sid=P-75MnY-zka6bx0TH9Sfj Incoming message: &{message {"channel":"AppearanceChannel"}... }
.
.
D 2021-09-21T00:56:03.469Z context=node sid=P-75MnY-zka6bx0TH9Sfj Incoming message: &{message {"channel":"AppearanceChannel"}... }
Websocket getting closed with 1005 status (Probably the client system has logged-off/hibernated)
D 2021-09-21T01:23:07.495Z context=node sid=P-75MnY-zka6bx0TH9Sfj Websocket closed: websocket: close 1005 (no status)
D 2021-09-21T01:23:07.495Z context=node sid=P-75MnY-zka6bx0TH9Sfj websocket session completed
D 2021-09-21T01:23:07.495Z context=node sid=P-75MnY-zka6bx0TH9Sfj Disconnect {"wm":"abcde"} http://abc.example.com/cable &map[REMOTE_ADDR:127.0.0.1 ..] [{"channel":"AppearanceChannel"} {"channel":"NotificationChannel"}]
D 2021-09-21T01:23:07.495Z channel={"channel":"NotificationChannel",..} context=hub sid=P-75MnY-zka6bx0TH9Sfj Unsubscribed
D 2021-09-21T01:23:07.495Z context=hub sid=P-75MnY-zka6bx0TH9Sfj Unregistered
D 2021-09-21T01:23:07.504Z context=rpc Disconnect response: status:SUCCESS
Fine till now.
Sequence 2: Things get weirder from now on. We get a connect-disconnect request every minute
D 2021-09-21T01:24:02.936Z context=rpc Authenticate response: status:SUCCESS identifiers:"{\"wm\":\"abcde\"}" transmissions:"{\"type\":\"welcome\"}" env:<cstate:... >
D 2021-09-21T01:24:02.936Z context=node sid=QJ2JeGgAsYzhPv6nQOBJ6 websocket session established
D 2021-09-21T01:24:02.936Z context=hub sid=QJ2JeGgAsYzhPv6nQOBJ6 Registered with identifiers: {"wm":"abcde"}
D 2021-09-21T01:24:02.967Z context=node sid=QJ2JeGgAsYzhPv6nQOBJ6 Websocket closed: websocket: close 1001 (going away)
D 2021-09-21T01:24:02.967Z context=node sid=QJ2JeGgAsYzhPv6nQOBJ6 websocket session completed
D 2021-09-21T01:24:02.967Z context=node sid=QJ2JeGgAsYzhPv6nQOBJ6 Disconnect {"wm":"abcde"} http://abc.example.com/cable &map[REMOTE_ADDR:127.0.0.1 ..] []
D 2021-09-21T01:24:02.967Z context=hub sid=QJ2JeGgAsYzhPv6nQOBJ6 Unregistered
D 2021-09-21T01:24:02.968Z context=rpc Disconnect response: status:SUCCESS
The above connect-disconnect loop occured every minute until 2021-09-28T06:25:08 and then the following
Sequence 3: Authentication failures every minute till today
D 2021-09-28T06:26:08.942Z context=rpc Authenticate response: status:FAILURE transmissions:"{\"type\":\"disconnect\",\"reason\":\"unauthorized\",\"reconnect\":false}"
E 2021-09-28T06:26:08.942Z context=ws Websocket session initialization failed: Application error:
D 2021-09-28T06:27:08.942Z context=rpc Authenticate response: status:FAILURE transmissions:"{\"type\":\"disconnect\",\"reason\":\"unauthorized\",\"reconnect\":false}"
E 2021-09-28T06:27:08.942Z context=ws Websocket session initialization failed: Application error:
..
..
..
today
We identified that the above requests are from the same client from NGINX access logs. We also found similar pattern occurred for 2 other IPs as well. We could not reproduce the behaviour. Can you please help us with some insights on when such loops occur?
call
for ApplicationCable::Connection:Class:", and have gone through every google result and github issue relating to it and still can't find a solution. It works fine on dev (running with overmind) only happens on staging (haven't deployed to prod yet) which is on a VPS configured through hatchbox. The ENV variables seem to be set correctly, but even though ACTION_CABLE_ADAPTER=any_cable
somehow ActionCable.server.config.cable
is equal to {"adapter"=>"redis", "url"=>"redis://10.3.96.3:6379/0"}
and not {"adapter"=>"any_cable"}
like it's supposed to be.
any_cable
in environments/staging.rb
like this ActionCable.server.config.cable = { "adapter": "any_cable", "url": ENV.fetch("ANYCABLE_REDIS_URL") }.with_indifferent_access
AnyCable::Rails.enabled? returns true like it should, but the that "undefined method call
for ApplicationCable::Connection:Class" error persists
[Action Cable] Broadcasting HallChannel-main msg: still (Duration: 1.8395630177110434)
Hi, everyone
I'm in need of some help.
I just migrated to AnyCable from ActionCable. AnyCable-Go and the RPC servers work without any issues. However, once I run the rails server, I get the following messageSuccessfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: keep-alive, Upgrade, HTTP_UPGRADE: websocket)
[2022-05-08 02:24:31.604] ERROR -- NotImplementedError: nil
The error stems from the subscribed method:
def subscribed
stream_from 'room_channel'
ActionCable.server.broadcast('room_channel', 'Message sent from backend')
end
Once I remove the stream_from 'room_channel'
line in the subscribed method, the error disappears and the front-end is then able to successfully connect to the channel.
Does anyone see what the issue is in the subscribed method?
Here's the link to the repo if anyone wants to take a look