"Invalid Parameter" when launching firefox.exe from cmd.exe /C

VERIFIED FIXED in Firefox 65

Status

()

defect
P1
normal
VERIFIED FIXED
8 months ago
7 months ago

People

(Reporter: ccorcoran, Assigned: aklotz)

Tracking

unspecified
Firefox 65
Unspecified
Windows
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox65 verified)

Details

Attachments

(1 attachment)

Steps to reproduce: Launch firefox from a cmd.exe shell as follows:
> cmd.exe /C start firefox.exe

I see a message box saying "Invalid Parameter". Clicking OK will continue normal execution.

A quick debug, it's failing on OpenProcess() because the parent PID (which was the child cmd.exe) is no longer running.

I reproduced this on mozilla-central rev 28497e7f30ae
Oh crap, I've seen this before, but before I changed everything over to mozilla::Result, the launcher would end up doing the right thing (TM) and away we would go.

It's simply a race with the fact that our launching process might not exist anymore.
Assignee: nobody → aklotz
Blocks: 1508885, 1509203
Status: NEW → ASSIGNED
Priority: -- → P1
Blocks: 1508940
If the launcher process's parent process was ephemeral, the parent may have
terminated before the launcher has a chance to open a handle to it. If so,
OpenProcess will fail with ERROR_INVALID_PARAMETER, as the pid is now invalid.

This is a common case, so instead of erroring out, IsSameBinaryAsParentProcess
should treat this case as, "No, our parent was not a Firefox binary" and just
return false.

This eliminated the intermittent xpcshell failures on try.
Pushed by aklotz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c8e66d503efd
Handle ERROR_INVALID_PARAMETER from OpenProcess differently from other errors in launcher process startup; r=cpearce
https://hg.mozilla.org/mozilla-central/rev/c8e66d503efd
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 65
Blocks: 1509929
Flags: qe-verify+
[testday-20181221] 

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
OS:  Windows 7 (64bit)
Status: Fixed & Verified 

Steps to reproduce: 
1) Press Windows Key + R
2) Type the following command in run box
> cmd.exe /C start firefox.exe
3) Firefox Launched without any error messages.

I have Reproduced the bug & The bug has been fixed in Firefox 65.0b6.
Thank you very much for verifying the issue.

Changing bug flags to verified fixed.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.