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

XPC Service hits 100% CPU and stops responding #43

Closed
timwredwards opened this issue Mar 11, 2023 · 15 comments
Closed

XPC Service hits 100% CPU and stops responding #43

timwredwards opened this issue Mar 11, 2023 · 15 comments
Labels
bug Something isn't working maybe fixed

Comments

@timwredwards
Copy link

timwredwards commented Mar 11, 2023

from maintainer: If the app is freezing for you, please check the 0.8.5 release

Hi,

I'm still trying to get this to work. Suggestions start appearing, but immediately the XPC service hits 100% CPU and completely stops responding.

This happens every single time, I have no idea why. Any ideas?
Screenshot 2023-03-11 at 2 21 18 pm
Screenshot 2023-03-11 at 2 24 40 pm

@intitni
Copy link
Owner

intitni commented Mar 11, 2023

Which version are you using? It's a known issue in 0.8.1 but should have been fixed in 0.8.2

@intitni
Copy link
Owner

intitni commented Mar 11, 2023

I guess it's 0.8.3 base on the screenshot.

Does it crash after stop responding? If so you can get a crash report from the Console.app.

If not, please let me know:

  • Does it happen in comment mode?
  • Where is the file located?
  • How big is the project you are opening in Xcode? Will it freeze if you run the command on a swift playground at ~/Desktop?
  • Would you mind sharing a copy of the file you were editing?

Or, maybe, can you run time profiler on the extension service?

@timwredwards
Copy link
Author

timwredwards commented Mar 11, 2023

Does it happen in comment mode?

No, only floating.

Where is the file located?

Locally

How big is the project you are opening in Xcode? Will it freeze if you run the command on a swift playground at ~/Desktop?

Yes, it still freezes.

Would you mind sharing a copy of the file you were editing?

It happens with every file, unfortunately.

@timwredwards
Copy link
Author

Does it crash after stop responding? If so you can get a crash report from the Console.app.

Sadly no, it doesn't crash, it just hangs.

@intitni
Copy link
Owner

intitni commented Mar 12, 2023

I can't reproduce the bug, so I need your help to locate it. I have prepared a modified version of the app, wherein I have disabled some features that may cause the problem. I have also added a few toggles in the host app, which you can use to turn these features back on. Please turn these toggles on one by one, and then run the ‘get suggestions’ command after making each change. Once you identify the toggle that causes the app to freeze, please let me know. Thanks.
Copilot for Xcode.app.zip

@cr2s367067
Copy link

Screenshot 2023-03-13 at 9 47 36 AM

It seems like, real-time suggestion with floating widget will cause the app freeze.

xcode version: 14.2
copilot for Xcode version: 0.8.2

@intitni
Copy link
Owner

intitni commented Mar 13, 2023

Screenshot 2023-03-13 at 9 47 36 AM

It seems like, real-time suggestion with floating widget will cause the app freeze.

xcode version: 14.2

copilot for Xcode version: 0.8.2

@cr2s367067 I can't reproduce it, would you mind installing the modified version mentioned above to help me locate the bug?

It would be better if you can do a time profiling on the app.

@intitni intitni added the help wanted Extra attention is needed label Mar 13, 2023
@cr2s367067
Copy link

Screenshot 2023-03-13 at 10 09 40 PM
Screenshot 2023-03-13 at 10 06 04 PM
Screenshot 2023-03-13 at 10 05 25 PM
Screenshot 2023-03-13 at 9 54 54 PM
Screenshot 2023-03-13 at 9 56 40 PM
Screenshot 2023-03-13 at 9 57 49 PM
Screenshot 2023-03-13 at 9 58 52 PM
Screenshot 2023-03-13 at 10 03 04 PM
Screenshot 2023-03-13 at 10 04 45 PM

The pictures above are a combination of the toggles, it looks like the suggestion panel and syntax highlighting will cause the freeze. I would love to keep testing it when I get free.

@intitni
Copy link
Owner

intitni commented Mar 13, 2023

@cr2s367067 Thank you. Do you mean all these combinations can cause freeze? If the syntax highlighting and suggestion panel looks suspicious to you, do you my trying the following?

A:

  • Turn every toggle on, but try to generate suggestions for a file that is not in Swift, for example a markdown file. Swift has its own syntax highlighter.

B:

  • Only turn off "Enable SuggestionPanelView code block". And would you mind telling me your macOS version?

@timwredwards
Copy link
Author

timwredwards commented Mar 13, 2023

Turn every toggle on, but try to generate suggestions for a file that is not in Swift, for example a markdown file. Swift has its own syntax highlighter.

Markdown also hangs

Only turn off "Enable SuggestionPanelView code block". And would you mind telling me your macOS version?

It works if you disable the SuggestionPanelView code block. But it doesn't work if you only disable syntax highlighting.

So the problem is with the code block, but not the syntax highlighting.

MacOS 13.1 (22C65)

@intitni
Copy link
Owner

intitni commented Mar 13, 2023

@timwredwards Thank you! I think we are pretty close to the real cause, I would guess it's some kind of SwiftUI bug. Here is a new version that changes the code block from LazyVGrid to VStack, and adds a new toggle to enable the code part in the code block view. Would you mind giving it a try? If it's still not working, I think I will have to make it a web view. Copilot for Xcode.app.zip

@cr2s367067
Copy link

Screenshot 2023-03-13 at 11 00 02 PM
Screenshot 2023-03-13 at 11 00 12 PM

Do you mean all these combinations can cause freeze?
Yes, those combination will cause freeze.

  • Markdown file with toggle on
    It is still freeze in markdown file with the every toggle on, and I try turn off "Enable SuggestionPanelView code block", it won't freeze, So I guess the panel will cause freeze the view.

  • Only turn off "Enable SuggestionPanelView code block
    It won't freeze the view.

macOS version: Ventrua 13.2.1

@intitni
Copy link
Owner

intitni commented Mar 13, 2023

@cr2s367067 Oops I thought it was some Apple bug fixed in 13.2.1, but looks like it's not because I am also at 13.2.1. Please also give the following version a try! Thank you.

@timwredwards Thank you! I think we are pretty close to the real cause, I would guess it's some kind of SwiftUI bug. Here is a new version that changes the code block from LazyVGrid to VStack, and adds a new toggle to enable the code part in the code block view. Would you mind giving it a try? If it's still not working, I think I will have to make it a web view. Copilot for Xcode.app.zip

@timwredwards
Copy link
Author

@timwredwards Thank you! I think we are pretty close to the real cause, I would guess it's some kind of SwiftUI bug. Here is a new version that changes the code block from LazyVGrid to VStack, and adds a new toggle to enable the code part in the code block view. Would you mind giving it a try? If it's still not working, I think I will have to make it a web view. Copilot for Xcode.app.zip

This seems to work, with all toggles activated! I'll keep testing and get back to you if I experience another hang.

@intitni
Copy link
Owner

intitni commented Mar 13, 2023

[Tears on my face]

@intitni intitni linked a pull request Mar 14, 2023 that will close this issue
@intitni intitni removed a link to a pull request Mar 14, 2023
@intitni intitni closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maybe fixed
Projects
None yet
Development

No branches or pull requests

3 participants