-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix(mxDebug): prevent spinning if connection closed #19
Conversation
This appears to be the functional equivalent of the macOS implementation of |
It's different. Look specifically at what happens when |
If it is different, it will take more time to look into this. the macOS version has been used as-is for years (and years) and doesn't exhibit the behavior described. |
Do note that the infinite loop is not within this function. It's some caller that isn't interpreting the connection closed (a debugBuffer of |
I wasn't able to reproduce by simply quitting xsbug. When xsbug cleanly exits, it sends an abort command to the running app which shuts it down. Through some experimentation, I was able to reproduce the problem with these steps:
That loops forever calling On macOS, the problem was solved by changing these lines to: count = read(CFSocketGetNative(the->connection), the->debugBuffer, sizeof(the->debugBuffer));
if (count <= 0) { |
Would you be able to make this change to the upstream XS? When that's done, I'm happy with closing this PR. |
Thank you for confirming that the proposed change resolves the issue for you. I've applied the change to the macOS, Windows, and Linux builds. It will be in the next update to the Moddable SDK repository, later this week. |
See #18 (comment) for steps-to-reproduce.
If the other side of the xsbug connection closes,
xsnap
andxsnap-worker
would go spinning up 100% CPU.If
recv
orread
returns a count of0
, we should close our end of the connection, too.