Giter VIP home page Giter VIP logo

Comments (5)

adam-stokes avatar adam-stokes commented on July 24, 2024

I think this gist would work perfectly in solving our timeout issues with long running processes or those that become defunct in sosreport's presence

https://gist.github.com/1306188

from sos.

bmr-cymru avatar bmr-cymru commented on July 24, 2024

If we're going to solve this we should solve it generally (fs access via addCopySpec* is vulnerable to the same problems). I'm interested to know if anyone has ideas here but the last time I looked into fork/exec/wait in python it seemed difficult to write this kind of thing robustly. I have one solution using an external C binary that's simple and covers the command cases well but if there are other suggestions we should evaluate those too.

from sos.

jhjaggars avatar jhjaggars commented on July 24, 2024

It's funny you guys are talking about this... The other day I started playing around with trying to figure out how to make this work and came up with this:

https://gist.github.com/7b75afd647a8dac49ef1

There are a lot of problems with trying to make one implementation. My implementation probably doesn't work on windows, but it will let you execute via a shell (which is what most calls expect).

A c-extension won't work for jython, but we might be able to use it for platforms that do and come up with a jython implementation to fall back on.

from sos.

bmr-cymru avatar bmr-cymru commented on July 24, 2024

I'd be interested to know what happens when the child gets into trouble - is a single fork and pipe enough to protect us from hanging inside p.communicate()?

from sos.

jhjaggars avatar jhjaggars commented on July 24, 2024

If you mean to use /usr/bin/timeout as a prepended shell argument on systems where it exists then we can do that under jython as well.

You can try my gist out like so

python timeout.py 10 "cat /dev/random > 10_seconds_of_dev_random"

Though, I'm not sure that is a good test either, as I doubt that will fill up any pipe buffers. p.communicate() is supposed to buffer into memory so we could always get into trouble there if we are drinking from a firehose.

from sos.

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.