Bug 221815 - run-parts will wait for processes put in background
Summary: run-parts will wait for processes put in background
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: crontabs
Version: 5
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-01-08 09:10 UTC by Dan Fruehauf
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-01-18 13:26:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
a patch for run-parts to not wait for background processes (388 bytes, patch)
2007-01-08 09:10 UTC, Dan Fruehauf
no flags Details | Diff

Description Dan Fruehauf 2007-01-08 09:10:47 UTC
Description of problem:
When running run-parts, it'll instantiate an awk program, this is all good and
ok, until you start to do some real things.
Assumine you have a script such as this :

example.sh :
#!/bin/bash
echo "hello"
sleep 10 &

And you would run :
./example.sh

It won't wait for the 'sleep 10 &' statement as it will be put in background.

But if you'd run :
./example.sh | awk '{print $1}'

You'd expect it to still quit immediately, but it doesn't, and I believe here
this is some normal awk behavior - I'm not reporting a bug on awk.

Problem comes when you'd use /usr/bin/run-parts, which does use awk to process
some output from the program, and just as well can cause any cronjob putting
some stuff in the background to halt, and wait.
Personally I witnessed it when combining a restart of mailman with run-parts,
which uses the 'daemon' function to run stuff in background - the result - the
cronjob would halt forever.

Some steps to reproduce, because I must provide it :
1. Create a new directory, say X for instance, and a script in it including the
lines :
#!/bin/bash
sleep 10 &

2. /usr/bin/run-parts X

Actual results:
It takes 10 seconds to complete.

Expected results:
Should complete immediately.

Additional info:
I'm including a patch, if what I'm describing is desired behavior, then a fix
should be done to the mailman service, or perhaps to the 'daemon' function.

Comment 1 Dan Fruehauf 2007-01-08 09:10:48 UTC
Created attachment 145037 [details]
a patch for run-parts to not wait for background processes

Comment 2 Marcela Mašláňová 2007-01-18 13:26:01 UTC
Hello,
thanks for report.

I don't think it's a bug but behaviour of bash/awk. It's a problem of correct
scripts for operation such these.


Note You need to log in before you can comment on or make changes to this bug.