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

maximum recursion depth exceeded #100

Closed
principejavier opened this issue Mar 22, 2019 · 5 comments
Closed

maximum recursion depth exceeded #100

principejavier opened this issue Mar 22, 2019 · 5 comments
Labels

Comments

@principejavier
Copy link

I'm getting these messages when using lsp-mode in Emacs for a large Fortran project:

LSP :: Connected to [fortls:30667 status:starting].
LSP :: maximum recursion depth exceeded while calling a Python object

Installed using

$ pip install fortran-language-server
$ pip -V
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
@hansec hansec added the bug label Mar 22, 2019
@hansec
Copy link
Owner

hansec commented Mar 22, 2019

Thanks for the report. This error usually happens when the language server accidentally produces circular references. For example, classA extends classB, which extends classA. Unfortunately, it is not straight forward to debug without access to example code. Is the source code for this project available or can you send it to me privately? If not, can you try and generate a reduced test case that shows this behavior?

@principejavier
Copy link
Author

Many thanks for your prompt reply. The project is private (in fact we are working to make it public) but I can give you access if you have an account at gitlab.

@hansec
Copy link
Owner

hansec commented Mar 22, 2019

Great, I'd be happy to take a look. My Gitlab username is the same as my GitHub one.

I will also work to add circular reference detection to provide more useful errors in the future.

@principejavier
Copy link
Author

Done. I would say there it is not a circular reference issue in the code (BTW, it is a general purpose, fully parallel finite element code if you are interested) but I might be wrong. A couple of comments:

  • Let me remark (again) that I'm not directly calling your parsing but through lsp-mode Emacs package
  • I also got another error when parsing a particular file, which I could report as another issue if you prefer.
  • There are some tricks we are using to bypass limitations of Fortran using fpp (metaprogramming, templatization, etc.) which may also generate troubles. I did not see any though.
  • We make intensive use of F200X features. It would be impressive if you manage to parse our code...
  • I can confirm that the parser works perfectly (through lsp) for a couple of examples we developed for an OO Fortran course (see the branch solution_exercises).

@hansec
Copy link
Owner

hansec commented Mar 22, 2019

It was pretty quick to sort out. The main issue was with circular user-defined type referencing. In this case your code has something like TypeC has a variable of TypeA and extends TypeB, which also extends TypeA. This is not a code error as it is supported in Fortran but tripped up my parser. This has been fixed in the v1.7 branch for the next release.

The other issue was a minor parsing bug where TYPE:: was tripping up the parser because it was expecting a space or comma immediately after the word TYPE in a user-defined type definition. This has also been fixed in the v1.7 branch for the next release.

As for features, most F2003/08 features that relate to requests supported in the language server protocol should be handled. However, indeed some operator overloading and "generic" features are not. These features should just be ignored though so if you run into issues with them let me know. Also, if there is a particular missing feature you would like feel free to open an issue or contribute a pull request.

Thanks again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants