Pure-D / serve-d

D LSP server (dlang language server protocol server)
MIT License
200 stars 48 forks source link

serve-d on M1 macOS is using 100% CPU (and killing my battery life :() #185

Closed hatf0 closed 2 years ago

hatf0 commented 2 years ago
Screen-Shot-2021-12-18-12-28-32

If I attach with lldb, and interrupt, the call stack is:

Screen-Shot-2021-12-18-12-28-59

I'm not sure why nanosleep is resulting in such a high CPU usage...

WebFreak001 commented 2 years ago

it might be doing something on other threads, if you still have it open, can you check if other threads are running?

hatf0 commented 2 years ago

Got this bug to trigger again, so I'll just dump the backtraces of each thread here:

Thread 2:

Screen-Shot-2021-12-21-13-20-05

Thread 3:

Screen-Shot-2021-12-21-13-20-16

Thread 4:

Screen-Shot-2021-12-21-13-20-40

Thread 5:

Screen-Shot-2021-12-21-13-20-55

Thread 6:

Screen-Shot-2021-12-21-13-21-23

Thread 7:

Screen-Shot-2021-12-21-13-21-39

Thread 8:

Screen-Shot-2021-12-21-13-21-54

Thread 9:

Screen-Shot-2021-12-21-13-22-07

Thread 10:

Screen-Shot-2021-12-21-13-22-21

Thread 11:

Screen-Shot-2021-12-21-13-23-04

Thread 12:

Screen-Shot-2021-12-21-13-23-17

Thread 13:

Screen-Shot-2021-12-21-13-23-33

Thread 14:

Screen-Shot-2021-12-21-13-23-46
WebFreak001 commented 2 years ago

seems like something might be causing an infinite loop in here: https://github.com/Pure-D/serve-d/blame/master/lsp/source/served/lsp/filereader.d

Heromyth commented 2 years ago

It's the same problem in Linux.

WebFreak001 commented 2 years ago

fixed with #187, release incoming

WebFreak001 commented 2 years ago

(actually untested if it actually fixes the issue, never reproduced the 100% issue before, but might help and improved API usage anyway)