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

Execution cache file is per script folder leading to error when running scripts in parallel #540

Closed
mungojam opened this issue Jun 1, 2020 · 7 comments
Labels

Comments

@mungojam
Copy link

mungojam commented Jun 1, 2020

I'm using dotnet script for some scripts which I run in parallel. Both scripts are in the same folder, but unless I turn off caching, this leads to a clash on the common cache file script.dll:

The process cannot access the file 'c:\somewhere\scripts\execution-cache\script.dll' because it is being used by another process.

The first script to get there works fine, but the 2nd fails because it tries to use the cache at the same time.

It works if I use --no-cache but I would rather not.

@mungojam
Copy link
Author

mungojam commented Jun 1, 2020

Oddly, it doesn't even work when I use --no-cache:

dotnet script --no-cache .\somewhere\configure-backend.csx

The process cannot access the file 'C:\Users\jenkins\AppData\Local\Temp\dotnet-script\C\somewhere\build-scripts\execution-cache\script.dll' because it is being used by another process.

@seesharper
Copy link
Collaborator

Hi @mungojam

The reason it probably won't work even with the --no-cache option is that we always run the script from a compiled script (script.dll).

That being said, the cache should definitely handle executing two scripts in parallell from the same folder. Looking into it👍

@seesharper seesharper added the bug label Jun 1, 2020
@mungojam
Copy link
Author

mungojam commented Sep 6, 2020

I've just spotted #507 which is related.

I'm planning on submitting a PR for this one first though, using the filename in the temporary folder path if that makes sense?

@kuacci
Copy link

kuacci commented Sep 11, 2020

Is it possible to implement an abstraction layer of file system just like what scriptcs did?

@mganss
Copy link

mganss commented Apr 12, 2021

A workaround is to set DOTNET_SCRIPT_CACHE_LOCATION to a separate directory for each of the scripts you are running in parallel.

@mungojam
Copy link
Author

mungojam commented Apr 12, 2021 via email

@mungojam
Copy link
Author

mungojam commented May 1, 2021

Fixed by #596

@mungojam mungojam closed this as completed May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants