-
Notifications
You must be signed in to change notification settings - Fork 245
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
Rename operation throwing exception #992
Comments
CDK 1.23.0 on Windows 10 Pro Have been trying already about 20 times to run
|
Hello, Assuming hopefully the temporary files aren't cleaned up, are you able to perform the rename in question manually? |
Additionally - have you tried to contact your antivirus vendor and ask about the symptoms you observe? If they are indeed causing this, they may be able to provide better indications as to how this should be fixed "properly". |
Hello @RomainMuller , |
But does the Antivirus vendor have documentation for how software should be made to inter-operate best with their process? |
Same thing here with .NET |
@RomainMuller They using Windows Defender that scans that file [see attached image] and looks like the file is closed before CDK is attempting the rename action. Manual rename operation also is not going through since CDK cleans up on failure. Environment info:
|
@karkohli Looks like some race condition may be occuring. We are looking into this. |
Hi, is there any news around this issue? |
@monnecc we haven't been able to reproduce this yet. We will update here when we get some time to dig in further. |
Configuring the anti virus software (Windows Defender in our case), does not appear to make a difference. We excluded the temporary directory in which the rename operation takes place ("Add-MpPreference -ExclusionPath ..."), but the "EPERM: operation not permitted, rename ..." error persists. So either there's an additional scanner running on our Windows boxes (this is a corporate environment not fully under our control) or the AV angle is a red herring. (This is CDK with Java and most team members gave up on running the command on Windows due to the low chances of a successful run.) |
Hi I'm also running into this error on average it takes me three times to be able to deploy my stack via cdk deploy. I'm running on Windows 10 Enterprise 1909. |
This is a hard issue for us to repro since its environment/configuration specific. Any more investigation any of you can do would be super helpful to getting this solved. I'd consider getting IT involved if they own the configuration of user permissions and AV policy. |
Is it easy possible to change the tmp/cache directory? that could solve the problem as well. |
@argenstijn supposedly setting the |
@argenstijn Setting the environment variable The only approach that worked for our team is to patch the code. Specifically, we globally install the jsii runtime ( |
I got the same error today when running |
After investigating this and trying out a couple of different workarounds (all of which felt gross, but one's gotta do what one's gotta do), I found out there is a way to change how this particular jsii kernel API works so that it no longer involves a |
When loading a new library into the jsii kernel, the provided `tarball` was extracted to a temporary directory, then moved into it's final location. On Windows, this operation could fail on an `EACCESS` or `EPERM` error (often due to malware scanners accessing the file for inspection on file systems which do not support renaming files that are being accessed). This changes how the `load` API works so taht the `tarball` is extracted directly in it's final install location, so that no rename operation is needed. Fixes #992 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Is there any resolution on this? |
@OlegBoulanov - I reckon the problem should go away with CDK |
@RomainMuller - thank you! |
Doesn't look fixed:
|
@OlegBoulanov - are you positive you're using version |
@RomainMuller - Yes, absolutely. These are two sequential commands |
Maybe I need to upgrade something else, too? |
Oh, sorry. There are no libraries but CDK itself |
So you are likely using 2 different CDK components: the CLI (which your message mentions you have at 1.44.0) and the libraries (since you're doing .NET, it'd be the |
@RomainMuller - sorry it took so long to confirm, and yes, referencing 1.45.0 packages fixes the problem Thank you! |
It works
Sent from Outlook Mobile<https://aka.ms/blhgte>
…________________________________
From: OlegBoulanov <notifications@github.com>
Sent: Tuesday, June 9, 2020 10:57:22 PM
To: aws/jsii <jsii@noreply.github.com>
Cc: argenstijn <argenstijn@hotmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [aws/jsii] Rename operation throwing exception (#992)
@RomainMuller<https://github.com/RomainMuller> - sorry it took so long to confirm, and yes, referencing 1.45.0 packages fixes the problem
Thank you!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#992 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAA75LGW54A3PB3LZNPBQJTRV2O3FANCNFSM4JN4HQIA>.
|
I seem to have the latest version of jsii and i get this "not permitted" error. |
im on cdk version 2.27.0 (build 8e89048) but im still facing the same issues, Caused by: software.amazon.jsii.JsiiException: EPERM: operation not permitted, rename 'C:\Users\a2414\AppData\Local\Temp\1\jsii-runtime-untar-dLGyec' -> 'C:\Users\a2414\AppData\Local\Temp\1\jsii-kernel-QuOmP0\node_modules\aws-cdk-lib' |
Windows does not allow renaming files that are currently open, or directories that contain open files. When antivirus software is used, files are open for analysis by the A/V software, making it impossible to rename files too quickly after they've been created. This was already reported in #992 and addressed, however the issue was re-introduced in #3724, in which tarballs were extracted into temporary directories that were then renamed. Changed the code back to a form taht extracts files directly into their final place instead of staging via a temporary space, and added comments warning maintainers about the specific issue being solved here, so that hopefully the problem does not get re-introduced again in the future. Fixes #3751
Windows does not allow renaming files that are currently open, or directories that contain open files. When antivirus software is used, files are open for analysis by the A/V software, making it impossible to rename files too quickly after they've been created. This was already reported in #992 and addressed, however the issue was re-introduced in #3724, in which tarballs were extracted into temporary directories that were then renamed. Changed the code back to a form taht extracts files directly into their final place instead of staging via a temporary space, and added comments warning maintainers about the specific issue being solved here, so that hopefully the problem does not get re-introduced again in the future. Fixes #3751 --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
🐛 Bug Report
Affected Languages
TypeScript
orJavascript
Python
Java
C#
,F#
, ...)General Information
What is the problem?
Invocation of
cdk
cli fails due to a permission error while renaming a file.As reported here https://stackoverflow.com/a/50297753 the cause likely to be the antivirus that blocks the operation. In my scenario I couldn't disable the A/V due to domain policy, so instead I've added a retry mechanism in the
doRename
function (cdk_venv/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:10408
):(please keep in mind that I have NO experience at all with JS, i'm sure that there are much better way to achieve this by using async/await for example, this is just to provide a minimal example)
Verbose Log
Full log https://gist.github.com/FabioGentile/29350501e3890305a94feff4b54ff1f8
Could it make sense to introduce something similar in the upstream version?
The text was updated successfully, but these errors were encountered: