-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple pushes per client for subscriptions that have a context_id
#1064
Comments
Thank you so much for creating an example! I will look into this today. |
We observe the same behavior and even worse: turning |
We are severely affected by this and prevents us from upgrading from 1.5 to 1.6 👀 |
In addition it looks like deduplication itself does not work anymore. Resolution happens for every subscribed client, which leads to performance issues. |
It seems like this PR (#775) is disabling the test that makes sure that de-duplications work as expected |
I'm using Absinthe in production and have started running into this problem as well. Has anyone had any luck on workarounds, or is using 1.5 the best option for now? |
Same issue here on 1.6.6, resolution happens for every subscribed client and all clients receive multiple updates. |
[Updated example below] This seems like a pretty significant security flaw. It appears to effectively cause the
All subscribers with the same document, regardless of their Example: Start two websockets and subscribe on both:
First is subscribed on I then run
and receive on both sockets:
If you are relying on |
Ah, this is by far the most succinct description of the issue, thanks for doing this. Let me look into this this weekend. |
Any update on this ticket? |
Also curious on if you made any progress on this @benwilson512 |
I have been trying to debug this bug and mostly found the fix for it. I have tested my fix on the example provided by @mupkoo ( Thank you!! ). But its a hacky solution in my opinion so I thought I should explain the problem here so someone can find a better solution? ( I will still open a PR for the fix so people can get going ). Background
Flow
So if there were 5 subscribers on phoenix then they all are connected to one topic.
This wasn't a problem when PR - #1175 Open to any advice on how to fix this?
|
Any progress on this? @benwilson512 @maartenvanvliet |
@benwilson512 @maartenvanvliet could we merge PR from prev comment? |
The PR has no tests, and it also says that it isn't the best solution. |
I can add tests but yeah this is not the best solution but it does work |
Tests would be very helpful. |
Ok will add tests ( will spent time on this on weekend ) |
Added a test similar to what is provided here https://github.com/mupkoo/absinthe-duplicate-subscriptions/blob/master/test/showcase_web/schema_test.exs#L5-L38 |
call me necroposter, but... would be nice to merge it if it wasn't solved somewhere else. |
It has been nearly a year now and it’s being used at scale at my company with no errors |
@girishramnani I think what's missing on your tests is Instead of: refute_receive(:broadcast) you should refute_received({:broadcast, _}) With those changes, your tests should break without what your code changes are fixing -- As previously requested by Ben. I'm happy to do that adjustment -- but I don't want to steal your thunder here. Also, side note. You mentioned before that your solution could be better. Your purpose is to avoid duplicates on the registry. The issue with that, by design, when the connection dies, the registry will be cleaned right? So, we have that out of the box with duplicate entries -- that said, in the ideal world, that could be fixed by redesigning the whole registry process and adding some supervisors to deregister things when connection processes die. However, your solution is still valid, IMO. But I'll let the signoff to @benwilson512 |
Has #1249 solved this? |
Yessir. We've been running with the latest build in production for ~2months with no issues |
@benwilson512 You might want to close this ticket, given the PR was merged 👍🏼 |
Environment
Expected behavior
Publishing to a subscription should result in just a single push per client.
Actual behavior
Using a subscription with a
context_id
results in the same number of pushes as the number of connected clients, so for example if you have 5 clients connected and you publish to a given subscription, all 5 clients will receive the data 5 times each.This is not true when there is no
context_id
Relevant Schema/Middleware Code
I have created a repository to showcase the problem.
https://github.com/mupkoo/absinthe-duplicate-subscriptions
Here is a quick view of
schema.ex
This is the test case that showcases the behaviour.
https://github.com/mupkoo/absinthe-duplicate-subscriptions/blob/master/test/showcase_web/schema_test.exs#L5-L38
I have mentioned this problem on the
absinthe_phoenix
package as wellabsinthe-graphql/absinthe_phoenix#83 (comment)
The text was updated successfully, but these errors were encountered: