Open ryuukk opened 1 year ago
It may be a problem with sublime text, i'll try to reproduce the freeze again and check sublime's log
And i'll try with vscode as well
I think it might not be stuck in an endless loop, but rather takes a very long time to process the source code - do you have any complex things such as very nested code or very long code? You would need to find out the file in which this loop started happening to better resolve it. You may not immediately notice it if you don't keep an eye on the serve-d status all the time.
I'll add a rough optimization step that will filter out all {}
blocks that don't contain the search token for the highlight code.
Code is not very complex, i got a freeze right now, while i was typing at line: 303
Notice the syntax check is also frozen
I checked in the log, i still receive jsons from serve-d, but the client doesn't seem to react to it
Could it be a worker thread that is stuck somewhere?
parsing code is sometimes synchronous, so if it is taking a very long time, it would also hang up all LSP communication. In case of highlighting related things, parsing code is synchronous.
I don't think it's slow, i left it for few minutes and still no response, main thread definitely is frozen and stuck on libdparse code
anyway I optimized some code here to avoid such deep AST visits, try out serve-d master
It froze again with your commit.. i suspect problem might be in workspace-d
In this while loop:
That's at least where the debugger says it stopped at
serve-d.exe;;7FF6BD93BDEC
serve-d.exe;;7FF6BD93B2BA
serve-d.exe;;7FF6BD931E5E
serve-d.exe;;7FF6BD931520
serve-d.exe;;7FF6BD92F3BA
serve-d.exe;;7FF6BD934FB1
serve-d.exe;;7FF6BD928D5D
serve-d.exe;;7FF6BD830F9A
serve-d.exe;;7FF6BD877981
serve-d.exe;;7FF6BD828B83
serve-d.exe;core.internal.array.appending._d_arrayappendcTXImpl!(std.experimental.lexer.TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;")[], std.experimental.lexer.TokenStructure!(ubyte, "import dparse.lexer:TokenTriviaFields,TriviaToken; mixin TokenTriviaFields;"))._d_arrayappendcTX();7FF6BCDC5237
serve-d.exe;workspaced.com.dcdext.IfFinder.visit();7FF6BCD9A763
Stuck appending some tokens then dunno where it goes
I disabled syntax check with: "d.enableLinting" : false,
and it no longer seems to freeze, so that's definitely something in that loop that is stuck in endless loop
I'll try to debug this further an other day, i am to finish this project i am working on for this week
I found the part of my code that trigger the freeze, i'll try to reduce the code so i can share it (can't share the whole thing since it's private)
I'm not sure what causes it exactly, but in my project, after a while, serve-d becomes stuck and eat CPU
After i managed to attach a debugger and here are 2 call stacks from 2 runs:
A different one after a retry: