-
Notifications
You must be signed in to change notification settings - Fork 86
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
segfault caused by os.execvpe in windows #84
Comments
Hello @matthewdeanmartin, I, too, utilize LocalStack on the Windows OS. I do not use gitbash and pipx, but in a normal powershell terminal or cmd terminal all works as expected. Could you clarify why installing Python is discouraged? The AWS CLI tool is also offered as a Python pip package, and awslocal serves as a thin wrapper around it. I recommend upgrading your WSL version to the latest version and using the endpoint URL http://localhost.localstack.cloud:4566 to potentially enhance connection speed. Alternatively, you could use AWS CLI version 2 and configure a profile in your ~/.aws/credentials and ~/.aws/config files. I hope this helps with your setup. |
Well I'm glad to hear it works on your machine. I see you all have a merge request to add github Actions to test on other operating systems & shells, you might want to merge that and include windows in the build matrix, who knows, you might see a break since os.execvpe isn't expected to behave the same on windows as linux: ref: https://stackoverflow.com/questions/67371606/how-to-replace-os-execvpe-on-windows-efficiently-if-the-child-process-is
I mean people shouldn't be installing all sorts of things into your system python, the python that exists before the first venv is created. I have dozens of cli commands installed on my machine, if they all install to the same site-packages, then each succeeding app will uninstall the preferred versions of the previous. This is why virtual environments exist. Pipx exists to keep cli tools out of the current venv and in their own isolated venv & also out of the system python. |
@matthewdeanmartin We actually do have a few windows machine, and haven't seen this report before, which makes it hard for us to act on it. |
Adding a +1 here for what it's worth. I also use windows 11 with git bash and get the segfault immediately. I haven't really been able to use PowerShell because it tends to interpret all my usual commands completely differently and throw strange errors unless I rewrite everything I was using successfully in git bash. |
Thanks for the update, @pandrews-phillips!
We can then try to dig into this. I'm really curious what that would be, given that this package is really just a tiny wrapper around the official AWS CLI... |
Sure, @alexrashed .
Edition Windows 11 Pro
Unfortunately all the output I can get is:
According to pip, 0.22.0
Yeah, the regular CLI is working fine from git bash. Let me know if you need any other info or would like me to run something else for debugging. Thanks. |
If possible, please provide us with the output of running the following commands. awslocal --debug s3 mb s3://test
aws --debug s3 mb s3://test --endpoint-url http://localhost:4566 I would suggest looking at the similar reports on the internet. It seems like the problem is with AV or permissions blocking it.
|
Antivirus is unlikely. The problem is I'll fork the library and publish a fix to pypi sometime today. It looks like in switching to subprocess you only lose interactive input from the user. and this guy says none of the exec* functions will ever work on any windows machine except by chance |
@matthewdeanmartin A PR contribution from a fork would definitely be great and would really help us get this over the line. 💯 We're happy to incorporate any suggested changes when we really can verify that we are tackling the issue at hand. |
@MarcelStranak I assume I don't need an active session or a real S3 bucket...
And the 2nd command has real output.
... A bunch of debug logging about loading JSON and looking for credentials and stack traces, I can copy it all in but since it worked I'm not sure the rest is relevant...
Skimming a few of those links that seems unlikely because in most of those cases the AV is causing all commands in git bash to segfault but in my case awslocal is the only command that errors. Git, gradle, pip, aws, python, jq, ls, act, ssh, etc, all work fine in the bash terminal. |
Okay this now works on windows for git-bash, cmd.exe and powershell https://pypi.org/project/awscli-local-win/ Recommended install
Run with
Comments
Python gives people more ways to do things that are useful, reliable or cross platform. The I appreciate the offer to create an PR, but now that I have a working solution, I'm good, thanks! |
@pandrews-phillips, Does the pip version work with other terminals like Windows Terminal, CMD, PowerShell (pwsh)? The logs you shared show that you are using AWS CLI v2. The wrapper is for AWS CLI v1. For AWS CLI v2, I would suggest setting your own custom profile to use as mentioned in https://docs.localstack.cloud/user-guide/integrations/aws-cli/#configuring-a-custom-profile.
You can verify the binary locations by using the I would also propose trying out the
After the run, it would look like this. You should have a similar list of installed packages at the end.
|
Yeah the system I think I'm using a Chocolatey-managed aws-cli with the pip awslocal:
Thanks, yeah running in the venv everything works as advertised:
So I suppose that points more to a problem with the calling mechanism and aws-cli v2 specifically? |
I'm using windows 11 and os.execvpe will cause a segfault. I happen to be using gitbash and pipx, but I get the same behavior if I don't use pipx.
After a bit of hacking, I got this to work, but with 2 second additional time cost over using
aws
directly. I see that 9 month ago execvpe was introduced probably to make things better for linux or mac usersI'm guessing you don't have access to a windows machine, you might want to consider a github action on a windows image to check to see if
awslocal --help
can run without segfault.Another possibility is to use something like shellingham to detect the shell before doing things that the OS isn't expected to be able to do.
When I use powershell or cmd, I get "ModuleNotFoundError: No module named 'boto3'", probably because the .bat file gets launched and doesn't actual activate the right environment, but I also got that even when installing to the system python (which is a no-no). I didn't pursue why the entry point scripts fail to get an activated environment, since I never use powershell or cmd.exe.
The text was updated successfully, but these errors were encountered: