Closed
Bug 600321
Opened 14 years ago
Closed 14 years ago
Mozrunner create process doesn't work in buildbot environment
Categories
(Testing :: Mozbase, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: cmtalbert, Assigned: k0scist)
References
Details
(Whiteboard: [mozmill-1.5.1+])
Attachments
(1 file, 3 obsolete files)
(deleted),
patch
|
cmtalbert
:
review+
|
Details | Diff | Splinter Review |
The killableprocess code uses windows job objects and createprocess to launch the process it is controlling. This causes issues when launched in a buildbot environment because buildbot also uses createprocess which prevents us from creating our own process that is unaffiliated with a job object.
More details as they come, but that's the broad strokes of the issue.
We get an "Access denied" error when we attempt to AssignProcessToJobObject.
Assignee | ||
Comment 1•14 years ago
|
||
Initially, I was working around this with a try: except: block for AssignProcessToJobObject. However, it was determined that we should
1. get the current process
2. see if the current process is part of the current job
3. if the process is part of the current job, then see if the job has the appropriate flags that should allow us to AssignProcessToJobObject
However, I get the following failure trying to do this:
mozilla@MOZILLA-QA /c/projects/mozilla-central/opt/dist/test-package-stage/mozmill
$ Scripts/python.exe Scripts/mozmill-script.py -b ../../bin/firefox.exe -t tests/firefox/ --showall
currentProc: <AutoHANDLE object at 0x00E877B0>
Traceback (most recent call last):
File "Scripts/mozmill-script.py", line 8, in <module>
load_entry_point('mozmill==1.5.0', 'console_scripts', 'mozmill')()
File "c:\projects\mozilla-central\opt\dist\test-package-stage\mozmill\Lib\site-packages\mozmill\__
init__.py", line 810, in cli
CLI().run()
File "c:\projects\mozilla-central\opt\dist\test-package-stage\mozmill\Lib\site-packages\mozmill\__
init__.py", line 758, in run
self.mozmill.start(runner=runner, profile=runner.profile)
File "c:\projects\mozilla-central\opt\dist\test-package-stage\mozmill\Lib\site-packages\mozmill\__
init__.py", line 242, in start
self.runner.start()
File "c:\projects\mozilla-central\opt\dist\test-package-stage\mozmill\mozrunner-2.5.1\mozrunner\__
init__.py", line 446, in start
self.process_handler = run_command(self.command+self.cmdargs, self.env, **self.kp_kwargs)
File "c:\projects\mozilla-central\opt\dist\test-package-stage\mozmill\mozrunner-2.5.1\mozrunner\__
init__.py", line 89, in run_command
return killableprocess.Popen(cmd, env=env, **killable_kwargs)
File "c:\mozilla-build\python25\lib\subprocess.py", line 593, in __init__
errread, errwrite)
File "c:\projects\mozilla-central\opt\dist\test-package-stage\mozmill\mozrunner-2.5.1\mozrunner\ki
llableprocess.py", line 157, in _execute_child
inJob = winprocess.IsProcessInJob(currentProc)
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type
Exception exceptions.WindowsError: WindowsError(6, 'The handle is invalid.') in <bound method AutoHA
NDLE.__del__ of <AutoHANDLE object at 0x00E877B0>> ignored
I have no idea how this is. Will attach patch.
Assignee | ||
Comment 2•14 years ago
|
||
this doesn't work. i have no idea why
Assignee | ||
Comment 3•14 years ago
|
||
You evidently can't use None on either the XP build env VM I have nor on buildbot
cool, looking good. I'd get rid of my snide remark beneath getCurrentProcess in winprocess.py (the "because os.getpid is too easy...) but otherwise, looks good.
Assignee | ||
Updated•14 years ago
|
Assignee | ||
Comment 5•14 years ago
|
||
this patch checks for if you're in a job; it also, as best i can tell, tries to check the job flags if you are in a job, however bug 600736 will have to be fixed first in order to test
(a test case should ultimately be added to mozrunner, but this is kinda a chicken+egg problem at this point)
Attachment #479831 -
Attachment is obsolete: true
Attachment #479925 -
Attachment is obsolete: true
Assignee | ||
Comment 6•14 years ago
|
||
This patch supposedly does the right thing and checks if you're in a job as well as flags on that job. In any case it will create a process, and if the first conditions are fulfilled, it will add it to a job object. I wrote a test for the one testable path: a parent launches a child, the child launches notepad. If more testing is needed, a nudge in the right direction would be appreciated (the right direction != copy+paste)
Attachment #481044 -
Attachment is obsolete: true
Assignee | ||
Updated•14 years ago
|
Attachment #481303 -
Flags: review?(ctalbert)
Updated•14 years ago
|
Assignee: nobody → jhammel
Status: NEW → ASSIGNED
Comment on attachment 481303 [details] [diff] [review]
check to see if you can launch jobs
This looks good, you did lots of good stuff here. I found some of the MSDN documentation for pieces that were missing, so update those and we're good to go.
>diff --git a/testing/mozmill/mozrunner-2.5.1/mozrunner/killableprocess.py b/testing/mozmill/mozrunner-2.5.1/mozrunner/killableprocess.py
>--- a/testing/mozmill/mozrunner-2.5.1/mozrunner/killableprocess.py
>+++ b/testing/mozmill/mozrunner-2.5.1/mozrunner/killableprocess.py
>+# XXX Magical numbers like 8 should be documented
> JobObjectBasicAndIoAccountingInformation = 8
>
>+# ...like magical number 9 comes from
>+# http://community.flexerasoftware.com/archive/index.php?t-181670.html
>+# I wish I had a more canonical source
>+JobObjectExtendedLimitInformation = 9
These numbers are documented here: http://msdn.microsoft.com/en-us/library/ms684925%28v=VS.85%29.aspx
Please update the comments.
>+# XXX these flags should be documented
> DEBUG_ONLY_THIS_PROCESS = 0x00000002
> DEBUG_PROCESS = 0x00000001
> DETACHED_PROCESS = 0x00000008
>
These are documented here, please update the comment: http://msdn.microsoft.com/en-us/library/ms684863%28VS.85%29.aspx
One other comment, why can't we take the tests out of the file and make them their own, separate python file?
Right now, I don't care that the tests are in there, but eventually I'd want to remove those from the file and make them their own file.
Attachment #481303 -
Flags: review?(ctalbert) → review+
Assignee | ||
Comment 8•14 years ago
|
||
(In reply to comment #7)
> Comment on attachment 481303 [details] [diff] [review]
> check to see if you can launch jobs
>
> This looks good, you did lots of good stuff here. I found some of the MSDN
> documentation for pieces that were missing, so update those and we're good to
> go.
Updated and removed some cruft. See updated patch at http://k0s.org/mozilla/hg/mozilla-central-patches/file/4ba270630f25/mozrunner-debugging (I can upload here if desired)
> One other comment, why can't we take the tests out of the file and make them
> their own, separate python file?
>
> Right now, I don't care that the tests are in there, but eventually I'd want to
> remove those from the file and make them their own file.
The only reason I threw them in there is that mozrunner on m-c (2.5.1) has no tests, currently, and wasn't sure where to put it. In addition, of course, this test is only applicable to windows.
I can put this elsewhere if you have a suggestion, but didn't really want to have some test_winprocess.py living somewhere.
Assignee | ||
Comment 9•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•