-
Notifications
You must be signed in to change notification settings - Fork 730
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
Msgs received on subscription with pending cancel cause unprocessedMessage error on remaining (uncancelled) subscription #2274
Comments
I've created a sample project at [link to apolloquestion0001 removed, outdated] that is able to replicate this issue fairly reliably. It includes
To run the server, go to the apolloquestion0001/server directory and do the following:
To run the iOS client, open the client/apolloquestion0001/apolloquestion0001.xcodeproj, reset the package cache at File -> Packages -> Reset Package Caches, then run the app in the simulator. (The iOS app connects to localhost:4000/graphql so it expects the server to be running on the same machine as the simulator). In the simulator, there will be a button to "Connect and Run Operations", which will start the two subscriptions. While receiving updates, click the "Cancel Thing2 subscription" button. A decent percentage of the time, this will result in this error, which will appear in the logs:
If the error doesn't occur, click "Cancel operations and disconnect", then try again through "Connect and Run Operations". The issue is that this error arrives on the subscription that was not cancelled, and we don't know what to do with it, or how to distinguish it from other errors. More specifically it is an unprocessed "Thing 2" message error, arriving in the error handler for the "Thing 1" subscription, on the path described as "Network Errors" in the Apollo docs at https://www.apollographql.com/docs/ios/fetching/error-handling In the example, I've handled it as follows:
(in client/apolloquestion0001/apolloquestion0001/ContentView.swift; you can set a breakpoint as indicated by the comment to catch the issue in action) So the question is, what should we do at Thing1's
(Side note: the sample server is providing an artificially high rate of subscription updates in order to make the issue more likely to happen. Our real application doesn't update this frequently, but does intermittently see the same unprocessed message error on non-cancelled subscriptions). |
Hi @wilsonmhpn 👋🏻 - thanks for the detailed reproduction case. We'll investigate and get back to you. |
I'm also seeing this in my project with some regularity. It's not causing any real harm, but it would be nice to silence the error. |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better. |
Bug report
In a situation where...
...then a subscription that is not being cancelled receives an
unprocessedMessage
error, for the message on the subscription that is being cancelled.Versions
Please fill in the versions you're currently using:
apollo-ios
SDK version: 0.48.0, also did a quick check on 0.51Steps to reproduce
unprocessedMessage
error on SubscriptionA(Note: I tried to reproduce this in a simple example, but I can't get sample app at apollographql/iOSTutorial.git to connect to the server from apollographql/fullstack-tutorial.git, it reports "Invalid HTTP upgrade" every time, even after trying a lot of combinations of device vs. simulator, ws vs. wss, etc, etc... no luck getting it to connect. But that's a separate matter.)
Further details
This is happening with some regularity with our application and server because the usage pattern we have tends to produce a message on the subscription almost simultaneously with the act of cancelling it. It ends up being difficult to reliably distinguish this error from a "real" error on SubscriptionA, without inspecting the implementation details in the error message to establish that it's "just an unprocessed message meant for our cancelled SubscriptionB".
The text was updated successfully, but these errors were encountered: