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

Azurite holds a lock on the two directories __blobstorage__ and __queuestorage__ #2356

Open
danielniccoli opened this issue Feb 5, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@danielniccoli
Copy link

Which service(blob, file, queue, table) does this issue concern?

blob, queue

Which version of the Azurite was used?

v3.29.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

Visual Studio Code Extension

What problem was encountered?

After starting and stopping Azurite in VSCode using the >Azurite: Start and >Azurite: Close commands, The extension still holds a lock on the two directories __blobstorage__ and __queuestorage__. Consequently, I am unable to delete these directories, for example to start anew, until I close VS Code. This makes that process unnecessary frustrating.

Steps to reproduce the issue?

  1. >Azurite: Start
  2. >Azurite: Close
  3. Try deleting __blobstorage__ and __queuestorage__ in the project root. Will fail.
  4. Close VS Code.
  5. Try deleting __blobstorage__ and __queuestorage__ in the project root. Will succeed.

Have you found a mitigation/solution?

No.

@blueww blueww self-assigned this Feb 6, 2024
@blueww blueww added the bug Something isn't working label Feb 6, 2024
@blueww
Copy link
Member

blueww commented Feb 6, 2024

@danielniccoli

Thanks for raising this issue!

In VS Code, Azurite is running in VS code process, so close Azurite will close the http service but can't stop whole process.

When Azurite read/save content in local disk, it will create Stream like

const stream = createReadStream(path, {
.
When create Stream Azurite will not set autoClose , and the autoClose default value is true (See link ). So Azurite depends on NodeJS to close the stream after finish using it. But currently it looks the stream is not closed and cause the related folder can't be deleted.

One workaround is: If you would like to have the content always be cleaned up after close Azurite, you can try to save the content in memory by enable following setting.
image

@danielniccoli
Copy link
Author

Thanks for mentioning the in-memory persisting option. This will work in most situations where I do not test crashes and replays.

Would it not be possible to manually close the stream when the close command is issued?

@blueww
Copy link
Member

blueww commented Feb 28, 2024

There are still not easy way to close the stream manually without changing the code, we need check all place to read the stream, and add code to close it after the last time using it. However, this might have regression risk, and we have other feature parity in hand, so this might won't be our recent priority.

@danielniccoli
Copy link
Author

It may just be enough to close the stream when issuing the Azurite Close command.

@blueww
Copy link
Member

blueww commented Feb 29, 2024

@EmmaZhu

Can your in progress PR #2331 fix this issue?
As we discussed, it looks also on closing file handles.

@EmmaZhu
Copy link
Collaborator

EmmaZhu commented Feb 29, 2024

@blueww ,

Yes, still working on it, will need to resolve some test failures.

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

No branches or pull requests

3 participants