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

Websocket Data Race when stream connection fails #3466

Closed
aaronbarsky opened this issue Oct 29, 2024 · 3 comments · Fixed by apollographql/apollo-ios-dev#529
Closed

Websocket Data Race when stream connection fails #3466

aaronbarsky opened this issue Oct 29, 2024 · 3 comments · Fixed by apollographql/apollo-ios-dev#529
Assignees
Labels
bug Generally incorrect behavior needs investigation

Comments

@aaronbarsky
Copy link

Summary

When stream connection fails triggering doDisconnect, the code to set the callback queue runs concurrently with doDisconnect which reads the callback queue.
Screenshot 2024-10-29 at 12 01 11 PM

I believe this can be resolved, by moving the assignment of the callback queue before the connect call (line 173 to 170).

Version

1.13.1

Steps to reproduce the behavior

It's a race condition, so it's hard to reproduce.
Discovered by running Xcode with the Thread Sanitizer enabled.

Logs

No response

Anything else?

No response

@calvincestari
Copy link
Member

Thanks @aaronbarsky. I can the see potential for the data race here so I've made the change in PR #529. To be honest it makes sense to assign the given queue as early as possible, I'm not sure why it was in that order before.

Copy link
Contributor

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.

@calvincestari
Copy link
Member

@aaronbarsky, this change is merged and will go out with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Generally incorrect behavior needs investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants