Bug 4750

Summary: interrupting bitbake doesn't kill all child processes
Product: [Build System, Metadata & Runtime] BitBake Reporter: Stefan Stanacar <sstncr>
Component: bitbakeAssignee: valentin <valentin.popa>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: jessica.zhang, poky.bs.watcher, poky.watcher, ross.burton, valentin.popa
Version: unspecified   
Target Milestone: 1.5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Stefan Stanacar 2013-06-19 09:04:20 UTC
Double Ctrl+C doesn't seem to kill all bitbake's sub-processes:

steps to reproduce:

1. Create a simple class with a simple task, e.g:


python do_testimage() {
    import subprocess, time
    subprocess.Popen("ping 127.0.0.1", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    # do something for a while
    endtime = time.time() + 1000
    while time.time() < endtime:
        pass

    

}
addtask testimage

2. bitbake something -c testimage: 
NOTE: Executing RunQueue Tasks
Currently 1 running tasks (164 of 164):
0: core-image-sato-1.0-r0 do_testimage (pid 9762)

Meanwhile check ps output


stefans   9671  4676  5 12:02 pts/0    00:00:03 python /home/stefans/z/poky/bitb
stefans   9720  9671 29 12:02 pts/0    00:00:15 python /home/stefans/z/poky/bitb
stefans   9742  9720  1 12:02 pts/0    00:00:00 python /home/stefans/z/poky/bitb
stefans   9762  9742 98 12:02 pts/0    00:00:39 python /home/stefans/z/poky/bitb
stefans   9765  9762  0 12:02 pts/0    00:00:00 ping 127.0.0.1



3. Double Ctrl+C bitbake -  build stops
However running bitbake <something> again

ERROR: Only one copy of bitbake should be run against a build directory

Check ps output again. I still have:

stefans   9762     1 99 12:02 pts/0    00:01:11 python /home/stefans/z/poky/bitb
stefans   9765  9762  0 12:02 pts/0    00:00:00 ping 127.0.0.1


I have to kill the ping process then the python process ends.
Comment 1 Stefan Stanacar 2013-06-19 09:09:41 UTC
I'm sorry for the ps truncated output, (narrow terminal and didn't used -w  option on ps -ef)

in step 2:
Currently 1 running tasks (164 of 164):
0: core-image-sato-1.0-r0 do_testimage (pid 10211)


stefans   9992  9989  0 12:05 pts/0    00:00:00 ping 127.0.0.1
stefans  10120  4676  7 12:07 pts/0    00:00:03 python /home/stefans/z/poky/bitbake/bin/bitbake core-image-sato -c testimage
stefans  10169 10120 37 12:07 pts/0    00:00:15 python /home/stefans/z/poky/bitbake/bin/bitbake core-image-sato -c testimage
stefans  10191 10169  2 12:07 pts/0    00:00:00 python /home/stefans/z/poky/bitbake/bin/bitbake-worker decafbad
stefans  10211 10191 99 12:07 pts/0    00:00:27 python /home/stefans/z/poky/bitbake/bin/bitbake-worker decafbad




in step 3:

stefans  10211     1 99 12:07 pts/0    00:01:31 python /home/stefans/z/poky/bitbake/bin/bitbake-worker decafbad
stefans  10214 10211  0 12:07 pts/0    00:00:00 ping 127.0.0.1
Comment 2 Stefan Stanacar 2013-06-19 09:13:30 UTC
poky commit  master:590010a6525b0e1bc1de73e794764e23404591df
Comment 3 Richard Purdie 2013-06-20 12:22:41 UTC
As another data point, we discovered a bug when we dropped pre python 2.7.3 support in that our multiprocessing pool workaround was always being used. There is a slim chance that now we require 2.7.3, the issue might be resolved...
Comment 4 Richard Purdie 2013-06-20 12:23:05 UTC
(In reply to comment #3)
> As another data point, we discovered a bug when we dropped pre python 2.7.3
> support in that our multiprocessing pool workaround was always being used.
> There is a slim chance that now we require 2.7.3, the issue might be
> resolved...

[Sorry, wrong bug for this comment :(]
Comment 5 Jessica 2013-06-27 14:52:04 UTC
Hi Cristiana and Ross

In the bug triage meeting, we decide to reassign this bug to Cristiana but very likely need Ross's help.  So please work together.
Comment 6 valentin 2013-07-30 08:28:27 UTC
Patch sent on bitbake-devel.
Comment 8 Stefan Stanacar 2013-10-07 13:38:55 UTC
Verified in master:3c5b6af99110bd7f64f5240a3e9d156f0593c497