CopilotForXcode icon indicating copy to clipboard operation
CopilotForXcode copied to clipboard

XPC Service hits 100% CPU and stops responding

Open timwredwards opened this issue 2 years ago • 15 comments

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

timwredwards avatar Mar 11 '23 14:03 timwredwards

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

intitni avatar Mar 11 '23 14:03 intitni

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?

intitni avatar Mar 11 '23 17:03 intitni

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 avatar Mar 11 '23 22:03 timwredwards

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.

timwredwards avatar Mar 11 '23 22:03 timwredwards

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

intitni avatar Mar 12 '23 01:03 intitni

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 avatar Mar 13 '23 04:03 cr2s367067

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 avatar Mar 13 '23 05:03 intitni

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.

cr2s367067 avatar Mar 13 '23 14:03 cr2s367067

@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?

intitni avatar Mar 13 '23 14:03 intitni

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)

timwredwards avatar Mar 13 '23 14:03 timwredwards

@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

intitni avatar Mar 13 '23 15:03 intitni

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

cr2s367067 avatar Mar 13 '23 15:03 cr2s367067

@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

intitni avatar Mar 13 '23 15:03 intitni

@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.

timwredwards avatar Mar 13 '23 15:03 timwredwards

[Tears on my face]

intitni avatar Mar 13 '23 15:03 intitni