Comments (5)
Actually, this being raised in subscriptions.rb when the identifier can't be found in the @subscriptions
array, could this be because we run multiple containers, and the user may be subscribed at another container?
from graphql-ruby.
Hi! Sorry for the trouble and thanks for the detailed report. What I expect on re-deploy is for clients to reconnect, re-sending GraphQL subscriptions as needed. A couple of quick thoughts:
- What caused this error to start occurring? Did you just add GraphQL subscriptions to your app, or did something else change that caused these to appear?
- Reviewing the backtrace above, I don't see anything GraphQL-related. Is there any indication that this is GraphQL-specific? (Are there other uses of ActionCable that work properly in your application?)
- You mention that you can't replicate the error locally. If you're using the app in production during a deploy, do you see anything happening in your browser?
- In AppSignal, can you see any trends in the occurences in this bug? (Maybe browser? I can imagine browsers handling this event in different ways...)
from graphql-ruby.
@rmosolgo Right, so to address your questions (and what I think is going on here as well):
- This error has been occurring for a very long time for us, but it doesn't seem to cause any issues. We've had a lot of ideas on what it could be, and none of those have turned out to be it. We haven't really prioritized it because like I said, it seems pretty harmless
- You're right, and I realized after posting this here that this may not be graphql-related and could be actioncable-related
3 & 4. We're not seeing anything related to the browser type for this, seems to be a mixed bag
I think it's that we have this in our GraphQLChannel
:
def subscribed
@subscription_ids = []
end
This would start each instance on a blank slate of connections, so if we're scaling and running 3-4 instances, they're all pushing to the same redis. One instance may pick up a subscriptions.trigger(...)
from puma on another instance, but doesn't have the gid
in its @subscription_ids
, because its not being shared.
Perhaps @subscription_ids
should be pointing to redis to maintain a shared list of subscribed clients?
from graphql-ruby.
My intention on @subscription_ids
is for that to be a per-instance list of subscribers to that instance. So it works like:
subscriptions.trigger
is called in one Ruby process, it calls.broadcast
to notify other processes of the trigger:graphql-ruby/lib/graphql/subscriptions/action_cable_subscriptions.rb
Lines 116 to 122 in 8270480
- meanwhile, any ActionCable process that received a subscription should have setup a
stream_from
for that subscriber: - So, when a process receives a notification from a trigger, it runs that
stream_from
block and generates a payload. Then it broadcasts again, using the specific subscription ID, to update the client:
I hope that helps!
from graphql-ruby.
@rmosolgo Thank you for taking the time out of the day to explain this a bit, appreciate it! :) We still haven't worked this issue out. We realized we weren't running ActionCable standalone in production, and thought perhaps this would be solved when we move ActionCable to be its own standalone service, but (I presume) because we also scale this out, this "issue" still persists.
We don't really know to what extent its an issue, or if it is an issue at all — e.g, are we getting a certain percentage of lost websockets pushes? or are these errors completely harmless?
So, when a process receives a notification from a trigger, it runs that stream_from block and generates a payload. Then it broadcasts again, using the specific subscription ID, to update the client
In this sense, should an ActionCable process that does not have the subscription_id
in its list of subscribers simply not pick this up? Do you see a way that it would happen in a multi-ActionCable setup that ActionCable processes routinely try to handle messages meant for subscriber_ids that they dont have?
from graphql-ruby.
Related Issues (20)
- Runtime manipulation of arguments breaks with commit "Cache resolved arguments better" HOT 7
- ignore HOT 1
- Can't get ActionCable subscriptions to work HOT 1
- [PRO] Changelog does not include upgrade information on the breaking change HOT 18
- More website improvements
- GraphQL::Analysis::AST::FieldUsage does not detect deprecated arguments inside mutation input objects HOT 2
- hasNextPage always is blank, unless 'first' argument is specified. HOT 5
- data loader cache shared between mutation loading and mutation resolving HOT 6
- Revisit argument / input_object validation
- Scoped context example breaks normalized stores HOT 3
- "stack level too deep" error when installing `2.2.0`+ HOT 3
- Put errors first in response HOT 1
- authorized? for GraphQL::Schema::EnumValue is not working HOT 2
- ActiveOperationLimiter does not work when I have enabled SentryTrace HOT 6
- Sentry tracing fails when Sentry is configured but no DSN is set
- Pro: operation store sync endpoint is not compatible for Rack 3's new `body` expectations HOT 3
- Complexity computations for fields on connections HOT 2
- JavaScript client should use strong typing for `onError` argument HOT 2
- `GraphQL::Schema::Interface#resolve_type` appears to resolve lazy results too early HOT 2
- Complexity calculation is not respecting the value in the resolver HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-ruby.