You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fortls crashes during initialization due to RecursionError when the workspace contains source files with deep nesting levels (about 200 nestings of IF~ENDIF). While it is acceptable to skip parsing such files, the bigger issue is fortls goes down entirely without any information to help me troubleshoot.
As far as I can tell, the RecursionError occurs while pickling (serialization/deserialization) the AST to pass the parse result from the worker process to the main process. It can happen when the AST has a deep nesting of scopes, and possibly for many other reasons.
To Reproduce
Place a source file with deep nesting levels in the workspace. Use the Python script below to create such a file:
levels=200print(" PROGRAM NESTED_IF")
print(" IF (.TRUE.) THEN\n"*levels, end="")
print(" END IF\n"*levels, end="")
print(" END PROGRAM NESTED_IF")
Open the workspace and start fortls.
Observe "Server initialization failed" error and you cannot use any function of fortls. You see no information about what caused it.
Expected behavior
Fortls should gracefully ignore such files instead of crashing entirely. Besides, user should be informed about which files caused the issue, so they can choose to remove those files from the workspace if desired.
I understand that such deeply nested source files are very rare, possibly machine-generated. I don't necessarily expect fortls to process them, as they may require additional resources and time that may not be worthwhile. I'm fine as long as fortls continues to function without being impacted by such exotic files.
Screenshots & Animations
Nothing to add.
Setup information (please complete the following information):
OS: Linux
Python Version: 3.10.12
fortls Version: 3.1.3
Code editor used: VS Code
the Fortran extension for the code editor and its version: Modern Fortran v3.2.0
Configuration information (please complete the following information):
Nothing special.
Additional context
I will post a PR of the suggested fix. Thank you very much!
The text was updated successfully, but these errors were encountered:
Describe the bug
fortls crashes during initialization due to RecursionError when the workspace contains source files with deep nesting levels (about 200 nestings of IF~ENDIF). While it is acceptable to skip parsing such files, the bigger issue is fortls goes down entirely without any information to help me troubleshoot.
The output message:
How it looks like in the VSCode GUI:
As far as I can tell, the RecursionError occurs while pickling (serialization/deserialization) the AST to pass the parse result from the worker process to the main process. It can happen when the AST has a deep nesting of scopes, and possibly for many other reasons.
To Reproduce
Expected behavior
Fortls should gracefully ignore such files instead of crashing entirely. Besides, user should be informed about which files caused the issue, so they can choose to remove those files from the workspace if desired.
I understand that such deeply nested source files are very rare, possibly machine-generated. I don't necessarily expect fortls to process them, as they may require additional resources and time that may not be worthwhile. I'm fine as long as fortls continues to function without being impacted by such exotic files.
Screenshots & Animations
Nothing to add.
Setup information (please complete the following information):
Configuration information (please complete the following information):
Nothing special.
Additional context
I will post a PR of the suggested fix. Thank you very much!
The text was updated successfully, but these errors were encountered: