actions / actions/toolkit

exec.exec fails to execute python executables in windows runners

Open
#992 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Initially we were thinking it was pip version 22.* that was causing the issue because installing pip version 21.3.1 before the pre-commit action step would allow it to run successfully. Since the failure was in the pre-commit action I opened an issue (https://github.com/pre-commit/action/issues/141) but I got told this issue was upstream. After digging into the code of the pre-commit action and tweaking the code in the pre-commit action, it also failed on execution of the pre-commit executable as well.

Running python executables will fail with the following error:

'C:\hostedtoolcache\windows\Python\3.10.1\x64\<executable>.exe' failed with exit code 3221225477

Looking up this error it appears to be a permission issue with the executables.

I'm not sure if this is where the issue actually lies but this is the next upstream spot it could be at.

To Reproduce

const exec = require('@actions/exec');
async function main() {
    await exec.exec('pip', ['install', 'pre-commit']);
    await exec.exec('pip', ['freeze', '--local']);
    await exec.exec('pre-commit', args);
}

I feel the above should work as well since it works just fine on other platforms.
I was able to get things working properly if I execute them as modules:

await exec.exec('python', ['-m', 'pip', 'install', 'pre-commit']);

Expected behavior
These calls should execute successfully.

Version Info
Using the latest version of the windows runner:

Current runner version: '2.287.1'
Operating System
  Microsoft Windows Server 2019
  10.0.17763
  Datacenter

This also uses the actions/setup-python@v2 action with CPython (3.10.1).

Additional context
https://github.com/praw-dev/praw/runs/5028100257?check_suite_focus=true#step:6:8
https://github.com/praw-dev/praw/runs/5043547347?check_suite_focus=true#step:6:20
https://github.com/praw-dev/praw/runs/5043313657?check_suite_focus=true#step:6:65
https://github.com/praw-dev/praw/issues/1843
https://github.com/praw-dev/praw/pull/1844
https://github.com/pre-commit/action/issues/141

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the @actions/exec entry point and reproduce the issue on the specified Windows runner with the pip and pre-commit calls from the report. Compare direct executable invocation with the working python -m form, then verify that the reported calls execute successfully without the Windows exit code.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python, typescript
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.