Closed Bug 968718 Opened 11 years ago Closed 11 years ago

[mozprocess] Calling wait() twice after kill() returns 0 instead of -sig

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

Attachments

(1 file, 2 obsolete files)

Right now we fail in our mozrunner thread tests for stopping the application because the returncode is 0 instead of -9. This happens because in kill() we declare the returncode as 0, and if process is already dead because another thread stopped it, it overwrites the former -sig returncode. https://github.com/mozilla/mozbase/blob/master/mozprocess/mozprocess/processhandler.py#L114 If the returncode has been set, we should really take that one.
Blocks: 967595
Actually this happens when you call wait() twice after the process has been stopped via kill(). I will have a fix for this today.
Status: NEW → ASSIGNED
Summary: [mozprocess] Process.kill() returns 0 instead of -sig if no process has been killed → [mozprocess] Calling wait() twice after kill() returns 0 instead of -sig
Attached file testcase (obsolete) (deleted) —
Assignee: nobody → hskupin
Attached patch Patch v1 (obsolete) (deleted) — Splinter Review
Simple patch with an additional test for this problem. It needs to be tested on OS X first before I want to ask for review.
Attachment #8371361 - Attachment is obsolete: true
Comment on attachment 8371460 [details] [diff] [review] Patch v1 Review of attachment 8371460 [details] [diff] [review]: ----------------------------------------------------------------- Tests are all green on OS X and Linux. Sadly tests are still all skipped on Windows.
Attachment #8371460 - Flags: review?(wlachance)
Comment on attachment 8371460 [details] [diff] [review] Patch v1 Review of attachment 8371460 [details] [diff] [review]: ----------------------------------------------------------------- Looks like William and Andrew are out the whole week. Jonathan, would you mind to review? Also adding Joel in case he could do it.
Attachment #8371460 - Flags: review?(wlachance)
Attachment #8371460 - Flags: review?(jgriffin)
Attachment #8371460 - Flags: feedback?(jmaher)
Comment on attachment 8371460 [details] [diff] [review] Patch v1 Review of attachment 8371460 [details] [diff] [review]: ----------------------------------------------------------------- ::: mozprocess/tests/test_mozprocess_wait.py @@ +104,5 @@ > + "process_waittimeout_python.ini"], > + cwd=here) > + p.run() > + p.kill() > + p.wait() should you verify the returncode from the first wait?
Attachment #8371460 - Flags: feedback?(jmaher) → feedback+
Comment on attachment 8371460 [details] [diff] [review] Patch v1 Review of attachment 8371460 [details] [diff] [review]: ----------------------------------------------------------------- Ditto jmaher's comments.
Attachment #8371460 - Flags: review?(jgriffin) → review+
Attached patch Patch v2 (deleted) — Splinter Review
Ups, you both are right. I missed to add this. Fixed it now. I will land it tomorrow with fresh eyes. Thanks!
Attachment #8371460 - Attachment is obsolete: true
Attachment #8371709 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Blocks: 969276
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: