[sos-devel] [RFC] wrap commands in /usr/bin/timeout when available

Jesse Jaggars jjaggars at redhat.com
Tue Mar 20 18:48:21 UTC 2012


On Tue, Mar 20, 2012 at 02:42:25PM -0400, Adam Stokes wrote:
> On 03/20/2012 02:39 PM, Jesse Jaggars wrote:
> >On Tue, Mar 20, 2012 at 06:32:25PM +0000, Bryn M. Reeves wrote:
> >>On 03/20/2012 06:21 PM, Jesse Jaggars wrote:
> >>>Using `timeout` is great for our situation since it allows us to offer a
> >>>shell to plugins (for easy pipelines). Also, there isn't much extra overhead
> >>>since we are forking from python anyways.
> >>That's true actually - I'd not thought of that extra side effect but
> >>it's neat.
> >>
> >>>The only major downside is that we will rely on the binary to implement
> >>>the timeout mechanism for us. This means that we either have to
> >>>implement alternative timeout methods for platforms that lack `timeout`
> >>>or fail to supply a timeout on those platforms. This is no worse than we
> >>>do today, so it's not much of a downside I don't suppose.
> >>Also true.. I think the fallback approach sounds like a good idea. This
> >>would also let us work on distributions that ship pre-7.x coreutils.
> >>Although I'd like to get timeout backported into the older Red Hat stuff
> >>we can still run into machines with outdated packages.
> >>
> >>>Given that we will likely want to try to provide an alternative timeout
> >>>method we should probably plan to plug in different implementations
> >>>somehow. Currently the method to fork a subprocess and do some work is
> >>>just a thin wrapper around subprocess.Popen. It would make sense to
> >>>allow a Policy object to override this implementation, though that might
> >>>be overkill for now since we can see if `timeout` exists and use it or
> >>>just do what we do now and hope for the best.
> >>If we're going to allow falling back on Linux hosts too I reckon this
> >>might be the way to go - policies can then look for a usable binary and
> >>decide which way to go. Or maybe it's better in the general plugin
> >>support code.. dunno - I think I'd need to see how it looked.
> >>
> >>Cheers,
> >>Bryn.
> >>
> >I think, in the simplest form, this commit shows how we can do this:
> >
> >https://github.com/jhjaggars/sosreport/commit/2300c2e0d61ad6a241e82ffbcfcb72822f1f70ee
> >
> >This patch offers no policy-level customization, but that might not
> >matter right away.
> >
> >Jesse
> One thing, maybe add a default timeout param somewhere

I think a default of 300 seconds is set everywhere, execept the (useless
IMO) callExtProg. I've added a passthrough for there as well.

Jesse
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/sos-devel/attachments/20120320/858f8c88/attachment.sig>


More information about the sos-devel mailing list