umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.4k stars 2.66k forks source link

Models builder: models.err is being used by another process #15954

Open PhyxionNL opened 5 months ago

PhyxionNL commented 5 months ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.2.2

Bug summary

An unhandled exception has occurred while executing the request.

System.IO.IOException: The process cannot access the file 'Models\Umbraco\models.err' because it is being used by another process.
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
   at Umbraco.Cms.Infrastructure.ModelsBuilder.ModelsGenerationError.Report(String message, Exception e)
   at Umbraco.Cms.Infrastructure.ModelsBuilder.AutoModelsNotificationHandler.GenerateModelsIfRequested()
   at Umbraco.Cms.Core.Events.INotificationHandler`1.Handle(IEnumerable`1 notifications)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishCore[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications)
   at Umbraco.Cms.Core.Events.NotificationHandlerWrapperImpl`1.Handle[TNotification,TNotificationHandler](IEnumerable`1 notifications, ServiceFactory serviceFactory, Action`2 publish)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishNotifications[TNotification,TNotificationHandler](IEnumerable`1 notifications)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)
   at Umbraco.Cms.Core.Events.EventAggregator.PublishAsync[TNotification](TNotification notification, CancellationToken cancellationToken)
   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)

Specifics

No response

Steps to reproduce

Open several document and/or data types in separate tabs, and save them quickly together. If the models builder fails, which is pretty much guaranteed when multiple requests try to generate models, it tries to write to the models.err file, which is already written to by another request.

Expected result / actual result

Models generation should be limited to one simultaneous execution.

github-actions[bot] commented 5 months ago

Hi there @PhyxionNL!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

Migaroez commented 1 month ago

Hey @PhyxionNL, before I try to reproduce this with all modelsbuilder modes, I presume you used SourceCodeAuto?

PhyxionNL commented 1 month ago

Hey @PhyxionNL, before I try to reproduce this with all modelsbuilder modes, I presume you used SourceCodeAuto?

Yes, that's right 👍🏻