Help needed, killing a process isn't...

Tim Penhey tim.penhey at canonical.com
Mon May 20 09:15:49 UTC 2013


On 20/05/13 21:00, roger peppe wrote:
> On 20 May 2013 05:26, Tim Penhey <tim.penhey at canonical.com> wrote:
>> The problem is that the outer cmd.Wait() still waits for the entire
>> process to finish before saying "sorry, signal 9" by way of the error
>> value.  The command being executed is just sitting in /bin/sleep.  This
>> should be very easily interrupted, but for some reason doesn't seem to be.
>>
>> I've already spent some time this afternoon chasing this, and not
>> getting anywhere, so I'm reaching out.
>>
>> Anyone got any clues?
> 
> The problem is that your Kill only kills bash, not the sleep
> process that it's running. Since you're trying to save the output,
> exec.Command.Wait waits for EOF, but that only happens when
> the sleep exits.
> 
> You can fix it by using "sleep sleep-time > /dev/null 2>&1" in
> your generated shell script.
> 
> BTW I think that we're trying to be too clever here. If there's
> a command that takes a while to generate its description,
> so what? Putting arbitrary timeouts in regular code seems
> wrong to me; if someone has a broken command installed,
> wouldn't  a reasonable way to find out what's going on be
> just to run --verbose and see that we're hanging up trying
> to get a description? (assuming we have appropriate logging
> statements in the code of course). Less code and arguably
> more correct.

I'm thinking you may well be right here, and we shouldn't try to be too
smart.

As I mentioned in the spec, supporting --description and --help should
be a required part of being a "real juju plugin".

Assuming that the plugins do this means the code is much simpler.

Cheers,
Tim




More information about the Juju-dev mailing list