Git Product home page Git Product logo

Comments (7)

dubois avatar dubois commented on May 10, 2024

My suggested fix is missing a "if tostdout:" before printing to stdout.

        if tostdout:
          sys.stdout.write(stdout.decode('utf-8'))
          sys.stdout.flush()

from pygitup.

msiemens avatar msiemens commented on May 10, 2024

Hey, thanks for reporting! That's an interesting edge case. I'll need a couple more details to look into this. Which version of Python are you using? Also, how exactly does the deadlock play out? Does PyGitUp just hang forever? Is there any output before the deadlock happens?

from pygitup.

dubois avatar dubois commented on May 10, 2024

from pygitup.

msiemens avatar msiemens commented on May 10, 2024

So I've thought a little about how we can solve this. It appears to me we have the following options:

  • Increase the buffer size. This is only a band-aid really, as we don't know beforehand how much stderr output there will be.
  • The solution you proposed seems to just wait for the subprocess to finish and then process stdout and stderr. This avoids the buffer problem but it also means we print the contents stdout after the subprocess finished instead of printing it live. Right now, we only need stdout printing for git fetch. So we could probably have a special implementation that does live output the way we do it now. This implementation then would only be used for git fetch where we probably won't run into buffering problems.
  • A more general solution would be to move stderr processing off to a separate thread (using something like this: http://stackoverflow.com/a/31867499/997063). This would be the most clean solution but would introduce multithreading as a potential source of problems. And I guess it may be just plain overkill.

What are your thoughts on this?

from pygitup.

dubois avatar dubois commented on May 10, 2024

from pygitup.

msiemens avatar msiemens commented on May 10, 2024

I've implemented a fix for the deadlock problem following option 2 I outlined earlier. In theory it may still deadlock when running git fetch but I doubt this command will be able to fill the buffer (default is 8 KB) with error messages.

Do you still have the repository that used to cause the deadlock? If so, could you verify the fix works? Of course you'd have to install PyGitUp from the latest master first.

from pygitup.

msiemens avatar msiemens commented on May 10, 2024

Closing due to inactivity, feel free to re-open if this is still an issue.

from pygitup.

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.