Giter Site home page Giter Site logo

Comments (5)

gatesn avatar gatesn commented on May 28, 2024

Will look to implement something similar to here: https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/

Sensible defaults but read logging config from file if it's available

from python-language-server.

HerringtonDarkholme avatar HerringtonDarkholme commented on May 28, 2024

Actually this problem is more serious. autozimu/LanguageClient-neovim#21

It seems writing to stderr blocks writing to stdout.

from python-language-server.

gatesn avatar gatesn commented on May 28, 2024

So the problem, as you pointed out, is that languageClient-neovim sets stderr=PIPE. What is happening is the client blocks waiting to read from stdout, Pyls fills up stderr buffer and blocks waiting to write to stderr and we end up in deadlock.

See here for more explanation:
http://stackoverflow.com/questions/1180606/using-subprocess-popen-for-process-with-large-output

What languageClient-neovim should be doing is use select to read off both stdout and stderr and then throwing away stderr if it doesn't think its relevant. Alternatively it could set stderr=None to just drop it entirely, it could redirect it to appear on the client's stderr, or it could pass in a file object to redirect stderr to disk.

I agree that Pyls should have more configurable logging and will work on implementing that, but it's not in any language server contract that logs cannot be written to stderr.

Equally changing the log level isn't sufficient as in the case there is a lot of ERROR messages it will still hang! Just happening less frequently.

So I think the solution here is for us to support configurable logging, and to make things easy for clients maybe a command line switch to redirect stderr to a file, but also for languageClient-neovim to properly handle stderr.

from python-language-server.

HerringtonDarkholme avatar HerringtonDarkholme commented on May 28, 2024

I don't think LanguageClient is the same as the stackoverflow question.

Actually PYLS blocks at writing to stdout, not stderr. Recorded here autozimu/LanguageClient-neovim#21

Source:
https://github.com/palantir/python-language-server/blob/master/pyls/jsonrpc.py#L155

from python-language-server.

gatesn avatar gatesn commented on May 28, 2024

@HerringtonDarkholme would be great to get your thoughts on this PR as a solution: #19

from python-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.