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

Attempting to add items to the in memory directory multiple times #183

Open
dc-durable opened this issue Mar 28, 2023 · 1 comment
Open

Comments

@dc-durable
Copy link

Hello,

I'm sorry there's not a huge amount to go on here as I couldn't recreate the issue locally, but using Smidge with Umbraco it looks like there are occasions where System.InvalidOperationException: Cannot add item to the directory, as an item with the same name already exists. is thrown when bundling. Having looked through the source, I can see in SmidgeController.cs a todo related to locking which may be related if Bundle is being called by multiple clients simultaneously?

My stack trace from the logs looks like this:

System.InvalidOperationException: Cannot add item to the directory, as an item with the same name already exists.
at Dazinator.Extensions.FileProviders.InMemory.Directory.FolderDirectoryItem.AddFile(IFileInfo file)
at Dazinator.Extensions.FileProviders.InMemory.Directory.InMemoryDirectory.AddFile(String folderPath, IFileInfo file)
at Smidge.InMemory.MemoryCacheFileSystem.WriteFileAsync(String filePath, Stream contents)
at Smidge.Controllers.SmidgeController.CacheCompositeFileAsync(ICacheFileSystem cacheProvider, String filePath, Stream compositeStream)
at Smidge.Controllers.SmidgeController.Bundle(BundleRequestModel bundleModel)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
... (outputs from other middleware)

Happy to answer any questions. Thank you.

@gurgendav
Copy link

I'm experiencing the same problem. @dc-durable have you been able to solve this somehow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants