Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssignProcessToJobObject: (87) The parameter is incorrect. #1118

Closed
joshuamwolfe opened this issue Apr 3, 2021 · 22 comments
Closed

AssignProcessToJobObject: (87) The parameter is incorrect. #1118

joshuamwolfe opened this issue Apr 3, 2021 · 22 comments
Labels
bug Something isn't working needs investigation Could be an issue - needs investigation

Comments

@joshuamwolfe
Copy link

Environment data

  • Language Server version: Pylance language server 2021.3.4
  • OS and version: Windows 10 Home, Version: 20H2, OS Build: 19042.867
  • Python version: Python 3.9.3

Expected behaviour

Vs Code to start without python server crashing.

Actual behaviour

The Python Tools server crashed 5 times in the last 3 minutes. The server will not be restarted.

Logs

Python language Server Output:

[Info - 11:55:56 AM] Pylance language server 2021.3.4 (pyright ba71f257) starting
[Info - 11:55:56 AM] Server root directory: c:\Users\Owner.vscode\extensions\ms-python.vscode-pylance-2021.3.4\dist
AssignProcessToJobObject: (87) The parameter is incorrect.

[Info - 11:55:57 AM] Connection to server got closed. Server will restart.
[Info - 11:55:57 AM] Pylance language server 2021.3.4 (pyright ba71f257) starting
[Info - 11:55:57 AM] Server root directory: c:\Users\Owner.vscode\extensions\ms-python.vscode-pylance-2021.3.4\dist
AssignProcessToJobObject: (87) The parameter is incorrect.

[Info - 11:55:58 AM] Connection to server got closed. Server will restart.
[Info - 11:55:58 AM] Pylance language server 2021.3.4 (pyright ba71f257) starting
[Info - 11:55:58 AM] Server root directory: c:\Users\Owner.vscode\extensions\ms-python.vscode-pylance-2021.3.4\dist
AssignProcessToJobObject: (87) The parameter is incorrect.

[Info - 11:55:58 AM] Connection to server got closed. Server will restart.
[Info - 11:55:59 AM] Pylance language server 2021.3.4 (pyright ba71f257) starting
[Info - 11:55:59 AM] Server root directory: c:\Users\Owner.vscode\extensions\ms-python.vscode-pylance-2021.3.4\dist
AssignProcessToJobObject: (87) The parameter is incorrect.

[Info - 11:55:59 AM] Connection to server got closed. Server will restart.
[Info - 11:55:59 AM] Pylance language server 2021.3.4 (pyright ba71f257) starting
[Info - 11:55:59 AM] Server root directory: c:\Users\Owner.vscode\extensions\ms-python.vscode-pylance-2021.3.4\dist
AssignProcessToJobObject: (87) The parameter is incorrect.

[Error - 11:56:00 AM] Connection to server got closed. Server will not be restarted.

Python Output:

Error 2021-04-03 11:55:56: Failed to get interpreter information for 'C:\Users\Owner\AppData\Local\Microsoft\WindowsApps\python3.exe' Error: Command failed: "C:\Users\Owner\AppData\Local\Microsoft\WindowsApps\python3.exe" "c:\Users\Owner.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py" "c:\Users\Owner.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\interpreterInfo.py"
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

at ChildProcess.exithandler (child_process.js:312:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {

killed: false,
code: 9009,
signal: null,
cmd: '"C:\\Users\Owner\AppData\Local\Microsoft\WindowsApps\python3.exe" "c:\Users\Owner\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py" "c:\Users\Owner\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\interpreterInfo.py"'
}

conda --version

Jupyter Output:

User belongs to experiment group 'pythonJoinMailingListVar3'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'jupyterTestcf'
User belongs to experiment group 'pythonFindInterpretercf'
Info 2021-04-03 11:55:55: ZMQ install verified.
Info 2021-04-03 11:55:55: id is 8ca66fba-0548-47cb-be1d-90d49ad6965a
Info 2021-04-03 11:55:55: Found existing keyfile at c:\Users\Owner\AppData\Roaming\Code\User\globalStorage\ms-toolsai.jupyter\nbsecret

First Issue, didnt think these applied to me.

I believe these are commented out instructions. I didn't think these applied to me. Opening command pallet to run an issue from with in vs-code wasn't an option. It didn't show up as an available command in the command pallet.

Enable trace logging by adding "python.analysis.logLevel": "Trace" to your settings.json configuration file. Adding this will cause a large amount of info to be printed to the Python output panel. This should not be left long term, as the performance impact of the logging is significant.
Note: If you think a GIF of what is happening would be helpful, consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ .

Code Snippet / Additional information

This is a very basic flask app for learning purposes, Code Snippets are probably not relevant.

@github-actions github-actions bot added the triage label Apr 3, 2021
@judej judej added the needs investigation Could be an issue - needs investigation label Apr 5, 2021
@github-actions github-actions bot removed the triage label Apr 5, 2021
@jakebailey
Copy link
Member

We saw this during early development, but were never able to reproduce it except on one machine in debug mode.

Is there anything interesting about your machine? Extra anti-virus? Do other node-related processes work? I assume VS Code works otherwise.

@joshuamwolfe
Copy link
Author

joshuamwolfe commented Apr 6, 2021

Hey.

I found a thread that I might have a bad download and that I should uninstall, then delete the file from ".vscode" file from the user/%username%/.vscodefile.

After I did that and re-installed. I had notifications appear. You should reload vscode (or) You should reload window. I did vscode reload everytime.

After I posted this; I hit reload window and everything seems to be fine. I included strange events in txt file (attached) and a screen of what I think my processes were at the time. I'll try to recreate and update this thread asap.

If things stay fine and we cant come up with anything relevant I'll close the issue.

Screenshot (18)
githubevents.txt

@joshuamwolfe
Copy link
Author

I just fired up my python project and it happened again.
Screenshot (19)
Which event log section should I look at? The text file events came from (event viewer > custom views > admin events)

@joshuamwolfe
Copy link
Author

Just reinstalled the extensions, no error yet. I use python formatter black, I have it installed globally so I didn't think I needed to install, but vscode asked me if I wanted to reinstall. Said yes. Seems to be working again. #fingerscrossed

@GreenBlackSky

This comment has been minimized.

@sisoe24

This comment has been minimized.

@jakebailey

This comment has been minimized.

@jakebailey

This comment has been minimized.

@jakebailey jakebailey reopened this May 12, 2021
@realcy
Copy link

realcy commented Jun 4, 2021

I meet the same problem after I upgrade to 2021.6.0 version. Then I downgrade to 2021.5.4, the error doesn't show.

OS and version: Windows 10 Home, Version: 1909, OS Build: 18363.1556
Python version: Python 3.9.5

@jakebailey
Copy link
Member

This is a month old closed issue. Please file a new issue with the template filled out; the python logs would also be helpful.

@Lakitna
Copy link

Lakitna commented Jul 8, 2021

It looks like I'm running into the same issue...

Log output
[Info  - 11:17:59] Pylance language server 2021.7.2 (pyright adb49aaa) starting
[Info  - 11:17:59] Server root directory: c:\Users\{my-user}\.vscode\extensions\ms-python.vscode-pylance-2021.7.2\dist
[Error - 11:17:59] Pyproject file "{monorepo-root}\api\pyproject.toml" is missing "[tool.pyright] section.
[Error - 11:18:00] Pyproject file "{monorepo-root}\indexer\pyproject.toml" is missing "[tool.pyright] section.
AssignProcessToJobObject: (87) The parameter is incorrect.

[Info  - 11:18:00] Connection to server got closed. Server will restart.
[Error - 11:18:00] Request textDocument/documentSymbol failed.
Error: Connection got disposed.
    at Object.dispose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:68124)
    at Object.dispose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:178678)
    at E.handleConnectionClosed (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:178890)
    at E.handleConnectionClosed (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:21817)
    at t (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:176983)
    at invoke (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:321403)
    at o.fire (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:322164)
    at X (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:57486)
    at invoke (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:321403)
    at o.fire (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:322164)
    at d.fireClose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:47555)
    at ChildProcess.<anonymous> (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:317133)
    at ChildProcess.emit (events.js:327:22)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
[Error - 11:18:00] Request textDocument/semanticTokens/full failed.
Error: Connection got disposed.
    at Object.dispose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:68124)
    at Object.dispose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:178678)
    at E.handleConnectionClosed (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:178890)
    at E.handleConnectionClosed (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:21817)
    at t (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:176983)
    at invoke (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:321403)
    at o.fire (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:322164)
    at X (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:57486)
    at invoke (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:321403)
    at o.fire (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:322164)
    at d.fireClose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:47555)
    at ChildProcess.<anonymous> (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:317133)
    at ChildProcess.emit (events.js:327:22)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
[Error - 11:18:00] Request textDocument/semanticTokens/range failed.
Error: Connection got disposed.
    at Object.dispose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:68124)
    at Object.dispose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:178678)
    at E.handleConnectionClosed (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:178890)
    at E.handleConnectionClosed (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:21817)
    at t (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:176983)
    at invoke (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:321403)
    at o.fire (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:322164)
    at X (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:57486)
    at invoke (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:321403)
    at o.fire (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:322164)
    at d.fireClose (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:59:47555)
    at ChildProcess.<anonymous> (c:\Users\{my-user}\.vscode\extensions\ms-python.python-2021.6.944021595\out\client\extension.js:9:317133)
    at ChildProcess.emit (events.js:327:22)
    at maybeClose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)

This logging repeats for every startup attempt.

Update: False alarm, there was a config issue due to a renamed VSCode workspace file.

@jakebailey
Copy link
Member

Update: False alarm, there was a config issue due to a renamed VSCode workspace file.

I'm curious about this; can you elaborate on this? What was incorrect and what did you do to fix it? We haven't had a way to reproduce this since we first saw it.

@Lakitna
Copy link

Lakitna commented Jul 9, 2021

The workspace file was rename from, let's say, foo.code-workspace to bar.code-workspace. It looked like that when I switched branches the workspace config was left in a sort of half-configured state causing the unexpected behavior.

I fixed my issue by opening VsCode with the new workspace file.

This probably won't help anyone else though :(

@jakebailey
Copy link
Member

Yeah, unfortunately not; I can't see how a VS Code specific file would cause this odd node+Windows failure; it's not the same process.

@shaofengzhu

This comment has been minimized.

@jakebailey

This comment has been minimized.

@basil96

This comment has been minimized.

@jakebailey jakebailey changed the title The Python Tools server crashed 5 times AssignProcessToJobObject: (87) The parameter is incorrect. Aug 18, 2021
@jakebailey jakebailey added the bug Something isn't working label Sep 1, 2021
@jakebailey
Copy link
Member

We can't reproduce this, so I don't know how we can fix it. As far as I can tell, it happens only on some Windows machines and only rarely.

VS Code has also updated their version of Node, which I'm hoping fixed this in the meantime.

@vtjnash
Copy link

vtjnash commented Sep 27, 2023

This looks to me like a kernel bug, but I have found a workaround for this issue for programs that use libuv, such as VSCode / nodejs: libuv/libuv#4152

The procedure to reproduce it are to:

  1. Call CreateJobObjectW to make a new job handle (this succeeds)
  2. Call CreateProcess on a Windows Store app (this succeeds)
  3. Call AssignProcessToJobObject on the resulting hProcess (this fails with ERROR_ACCESS_DENIED)
  4. Call CreateProcess on a desktop app (this succeeds)
  5. Call AssignProcessToJobObject on the resulting hProcess (this fails with INVALID_PARAMETER)

@deepak1556
Copy link

Thanks @vtjnash for looking into this issue and addressing it! didn't realize windows store app would be the trigger and successive CreateProcess calls would be affected. I was trying to get a minimal repro but now I see why that didn't work microsoft/vscode#186912 (comment)

@vtjnash
Copy link

vtjnash commented Sep 29, 2023

I was fortunate to have been given a much smaller reproducer. I only found this issue because I was searching for people who had solutions to it, and only came across a few places where people had had the same problem. Do you have a contact in the kernel team to ask whether they could see if this is a kernel issue or whether they could add a clarification to the documentation for AssignProcessToJobObject about this case?

@deepak1556
Copy link

Don't have any known contacts, but I can ask around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation Could be an issue - needs investigation
Projects
None yet
Development

No branches or pull requests