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

Crashes on iOS caused by DNSServiceProcessResult #91

Closed
foxik0169 opened this issue Apr 8, 2024 · 2 comments · Fixed by #94
Closed

Crashes on iOS caused by DNSServiceProcessResult #91

foxik0169 opened this issue Apr 8, 2024 · 2 comments · Fixed by #94
Assignees
Labels
bug Something isn't working

Comments

@foxik0169
Copy link

Describe the bug
When calling resolve on a lot services (10+) on iOS there is potential for a crash in DNSServiceProcessResult() function. This can happen because the underlying socket is not available anymore. To fix this, I've implemented asynchronous socket access with DispatchSourceRead. The code can be seen in my fork https://github.com/foxik0169/Bonsoir/tree/5.1.9-stream. There are more changes because I went ahead and make the DNSServiceProcessResult() call work concurently and then send the messages to Flutter on main thread.

To Reproduce
Part of the issue is that is not easily reproducible. For my network setup (hotspot on PC and 3 wifi devices connected) it did not happen at all. However when on a wifi that contains a lot of services (10+) with the type that I am trying to resolve, it might crash. All these devices are being resolved at the same time.

Expected behavior
No crashes in the native code.

Screenshots
image

Smartphone (please complete the following information):

  • Device: iPhone 12
  • OS: iOS 17.4.1
@foxik0169 foxik0169 added the bug Something isn't working label Apr 8, 2024
@Skyost
Copy link
Owner

Skyost commented Apr 9, 2024

Hey,

Great, this could even be related to #89. Feel free to open a PR once you're ready 🙂

@heiha100
Copy link
Contributor

Describe the bug When calling resolve on a lot services (10+) on iOS there is potential for a crash in DNSServiceProcessResult() function. This can happen because the underlying socket is not available anymore. To fix this, I've implemented asynchronous socket access with DispatchSourceRead. The code can be seen in my fork https://github.com/foxik0169/Bonsoir/tree/5.1.9-stream. There are more changes because I went ahead and make the DNSServiceProcessResult() call work concurently and then send the messages to Flutter on main thread.

To Reproduce Part of the issue is that is not easily reproducible. For my network setup (hotspot on PC and 3 wifi devices connected) it did not happen at all. However when on a wifi that contains a lot of services (10+) with the type that I am trying to resolve, it might crash. All these devices are being resolved at the same time.

Expected behavior No crashes in the native code.

Screenshots image

Smartphone (please complete the following information):

  • Device: iPhone 12
  • OS: iOS 17.4.1

hey, I am facing the same problem. And Thanks for your solution. Would you open a PR for this issue🩷

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

Successfully merging a pull request may close this issue.

3 participants