Skip to content
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

Low-level websocket error when connecting to -api #228

Open
fnoop opened this issue Apr 8, 2020 · 5 comments
Open

Low-level websocket error when connecting to -api #228

fnoop opened this issue Apr 8, 2020 · 5 comments
Assignees
Labels
bug 🐛 Something isn't working
Milestone

Comments

@fnoop
Copy link
Member

fnoop commented Apr 8, 2020

Looks like when initial subscription is made the websocket gets cut off or interrupted. Is it from the server side? Can't see anything obvious in the logs.
Screenshot 2020-04-08 at 08 18 42

Screenshot 2020-04-08 at 08 19 19

@SamuelDudley
Copy link
Member

The top one is new to me. Do you think it has something to do with the client attempting to connect to /subscriptions before the schema has loaded? Will investigate further on -api side.

I have certainly seen the bottom one before. I think it's related to the browser trying to reconnect to a websocket -api has closed. Possibly -api is closing them incorrectly. I'll investigate.

@fnoop
Copy link
Member Author

fnoop commented Apr 8, 2020

Sorry should have been clearer - they're both the same thing but seen in different browsers. The top one is firefox, the bottom one is chrome. This happens when the page is first loaded, and the clients are first loaded. It's happening right down at the apollo client level.
We've changed all the client creation to async, but it doesn't try to create the initial query/subscription until the schema has been fully downloaded and parsed:

          // If schema has been fetched, proceed to create Status query/subscription
          if (newValue[api].schemaready === true) {
            this.createQuery('Status', statusQuery, api, null, null, this.processStatusQuery)
            this.createSubscription('Status', statusSubscription, api, null, null, this.processStatusSubscription)
          }

It's entirely possible it's something to do with timing at the client end..

@SamuelDudley
Copy link
Member

Okay. If you close the web browser, restart -api and then load the page do you see the error?

@fnoop
Copy link
Member Author

fnoop commented Apr 8, 2020

No, although actually if I hit reload lots of times it happens sometimes and not others. Odd. I guess that probably points to a brower-side timing issue with the async calls?

@SamuelDudley
Copy link
Member

I actually think it's to do with -api and websocket connections not being disposed of correctly. There is an error that occurs in the logs I see every now and then generated from here https://github.com/goodrobots/maverick-api/blob/master/maverick_api/modules/base/tornadoql/subscription_handler.py#L211

@SamuelDudley SamuelDudley added the bug 🐛 Something isn't working label Apr 21, 2020
@SamuelDudley SamuelDudley self-assigned this Apr 21, 2020
@SamuelDudley SamuelDudley added this to the 1.3 milestone Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants