Exception of type 'System.OutOfMemoryException' was thrown.

2 weeks ago
Hello,

I am facing error of below every time.

Anybody help me to resolve it?

Full message
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Threading.Thread.StartInternal()
   at System.Threading.Thread.Start()
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.OpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at LinqToDB.Data.DataConnection.EnsureConnectionAsync(CancellationToken cancellationToken)
   at LinqToDB.Data.DataConnection.QueryRunner.ExecuteReaderAsync(CancellationToken cancellationToken)
   at LinqToDB.Linq.QueryRunner.ExecuteQueryAsync[T](Query query, IDataContext dataContext, Mapper`1 mapper, Expression expression, Object[] ps, Object[] preambles, Int32 queryNumber, Func`2 func, TakeSkipDelegate skipAction, TakeSkipDelegate takeAction, CancellationToken cancellationToken)
   at LinqToDB.Linq.Builder.FirstSingleBuilder.FirstSingleContext.<>c__DisplayClass4_0`1.<<GetFirstOrDefaultElement>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at LinqToDB.Linq.ExpressionQuery`1.LinqToDB.Async.IQueryProviderAsync.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
   at Nop.Data.EntityRepository`1.<>c__DisplayClass7_0.<<GetByIdAsync>g__getEntityAsync|0>d.MoveNext() in C:\andrei\nop_sources\src\Libraries\Nop.Data\EntityRepository.cs:line 124
--- End of stack trace from previous location ---
   at Nop.Core.Caching.MemoryCacheManager.GetAsync[T](CacheKey key, Func`1 acquire) in C:\andrei\nop_sources\src\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 116
   at Nop.Data.EntityRepository`1.GetByIdAsync(Nullable`1 id, Func`2 getCacheKey, Boolean includeDeleted) in C:\andrei\nop_sources\src\Libraries\Nop.Data\EntityRepository.cs:line 134
   at Nop.Services.Media.PictureService.GetPictureByIdAsync(Int32 pictureId) in C:\andrei\nop_sources\src\Libraries\Nop.Services\Media\PictureService.cs:line 698
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.<>c__DisplayClass22_2.<<PrepareCategoryMenuModelsAsync>b__3>d.MoveNext() in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 209
--- End of stack trace from previous location ---
   at Nop.Core.Caching.MemoryCacheManager.GetAsync[T](CacheKey key, Func`1 acquire) in C:\andrei\nop_sources\src\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 116
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.PrepareCategoryMenuModelsAsync(IList`1 allCategories, Int32 rootCategoryId, Boolean loadPicture, Boolean loadRightPanelPicture, Boolean loadSubCategories, Boolean skipItems) in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 207
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.PrepareCategoryMenuModelsAsync(IList`1 allCategories, Int32 rootCategoryId, Boolean loadPicture, Boolean loadRightPanelPicture, Boolean loadSubCategories, Boolean skipItems) in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 246
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.PrepareCategoryMenuModelsAsync(IList`1 allCategories, Int32 rootCategoryId, Boolean loadPicture, Boolean loadRightPanelPicture, Boolean loadSubCategories, Boolean skipItems) in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 246
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.<>c__DisplayClass21_0.<<PrepareCategoryMenuModelsAsync>b__0>d.MoveNext() in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 137
--- End of stack trace from previous location ---
   at Nop.Core.Caching.MemoryCacheManager.GetAsync[T](CacheKey key, Func`1 acquire) in C:\andrei\nop_sources\src\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 116
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.PrepareCategoryMenuModelsAsync() in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 130
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.<PrepareMegaMenuModelAsync>b__24_0() in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 327
   at Nop.Core.Caching.MemoryCacheManager.GetAsync[T](CacheKey key, Func`1 acquire) in C:\andrei\nop_sources\src\Libraries\Nop.Core\Caching\MemoryCacheManager.cs:line 116
   at Nop.Plugin.NopStation.MegaMenu.Factories.MegaMenuModelFactory.PrepareMegaMenuModelAsync() in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Factories\MegaMenuModelFactory.cs:line 308
   at Nop.Plugin.NopStation.MegaMenu.Components.MegaMenuViewComponent.InvokeAsync() in D:\E-Drive\Projects\orchidtheme_440\src\Plugins\Nop.Plugin.Nopstation.MegaMenu\Components\MegaMenu.cs:line 29
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsyncCore(ObjectMethodExecutor executor, ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments)
   at AspNetCore.Plugins_NopStation_MegaMenu_Views_Shared_TopMenu.ExecuteAsync() in C:\Inetpub\vhosts\radhedesigner.com\httpdocs\Plugins\NopStation.MegaMenu\Views\Shared\TopMenu.cshtml:line 4
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.ViewViewComponentResult.ExecuteAsync(ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments)
   at AspNetCore.Themes_Orchid_Views_Shared__Root.ExecuteAsync() in C:\Inetpub\vhosts\radhedesigner.com\httpdocs\Themes\Orchid\Views\Shared\_Root.cshtml:line 35
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultFilters>g__Awaited|27_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_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.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at WebMarkupMin.AspNetCore5.WebMarkupMinMiddleware.ProcessAsync(HttpContext context, Boolean useMinification, Boolean useCompression)
   at WebMarkupMin.AspNetCore5.WebMarkupMinMiddleware.ProcessAsync(HttpContext context, Boolean useMinification, Boolean useCompression)
   at WebMarkupMin.AspNetCore5.WebMarkupMinMiddlewareBase.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 125
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Nop.Services.Authentication.AuthenticationMiddleware.InvokeAsync(HttpContext context) in C:\andrei\nop_sources\src\Libraries\Nop.Services\Authentication\AuthenticationMiddleware.cs:line 94
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.<Invoke>g__AwaitMatch|8_1(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Nop.Services.Installation.InstallUrlMiddleware.InvokeAsync(HttpContext context, IWebHelper webHelper) in C:\andrei\nop_sources\src\Libraries\Nop.Services\Installation\InstallUrlMiddleware.cs:line 53
   at Nop.Services.Common.KeepAliveMiddleware.InvokeAsync(HttpContext context, IWebHelper webHelper) in C:\andrei\nop_sources\src\Libraries\Nop.Services\Common\KeepAliveMiddleware.cs:line 50
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
IP address
85.208.96.208
Customer
builtin@search_engine_record.com
Page URL
https://radhedesigner.com/login?returnUrl=%2Ff6402
Referrer URL
Created on
4/13/2024 11:43:55 PM
2 weeks ago
How much memory does you server have ?
Probably the solution is to add more memory
2 weeks ago


i am share my server system image.

the server have 8GB ram
2 weeks ago
8GB of memory should be okay.
By the looks of the error log, the source of the error is the  Mega menu plugin. Can you try disabling the plugin and see how It goes? If it works then it will be better if you contact the plugin's vendor directly.

Also, looking at the customer in the log, looks like the web crawlers are accessing the login page. It is recommended to disallow the crawling on the login page. Have you customized your robots.txt?
2 weeks ago
hello,
I am remove it that and need to reset menu in website.

thank you
2 weeks ago
According to your stack trace, the Mega Menu is accessing pictures from the DB.
at Nop.Services.Media.PictureService.GetPictureByIdAsync(Int32 pictureId) in

Maybe your pictures are too big. (Very large # of bytes)

However, what's unusual is that the memory exception happens when trying to get a DB connection from the pool:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
...
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,


Check your System > Log to see if you're getting other DB errors (e.g., Timeouts)

In your \App_Data\appsettings.json what is your ConnectionString?
(post here with any userid/password removed)
2 weeks ago
hello,

my database connection string are below.


{
  "DataConnectionString": "Data Source=190.92.173.67;Initial Catalog=DB_146186_nop;Integrated Security=False;Persist Security Info=False;User ID=@@@@;Password=@@@@",
  "DataProvider": "sqlserver",
  "SQLCommandTimeout": null,
  "RawDataSettings": {}
}
2 weeks ago
appsettings.json   file detail below


{
  "CacheConfig": {
    "DefaultCacheTime": 60,
    "ShortTermCacheTime": 3,
    "BundledFilesCacheTime": 120
  },
  "HostingConfig": {
    "UseHttpClusterHttps": false,
    "UseHttpXForwardedProto": false,
    "ForwardedHttpHeader": ""
  },
  "DistributedCacheConfig": {
    "DistributedCacheType": "redis",
    "Enabled": false,
    "ConnectionString": "127.0.0.1:6379,ssl=False",
    "SchemaName": "dbo",
    "TableName": "DistributedCache"
  },
  "AzureBlobConfig": {
    "ConnectionString": "",
    "ContainerName": "",
    "EndPoint": "",
    "AppendContainerName": true,
    "StoreDataProtectionKeys": false,
    "DataProtectionKeysContainerName": "",
    "DataProtectionKeysVaultId": ""
  },
  "InstallationConfig": {
    "DisableSampleData": false,
    "DisabledPlugins": "",
    "InstallRegionalResources": true
  },
  "PluginConfig": {
    "ClearPluginShadowDirectoryOnStartup": true,
    "CopyLockedPluginAssembilesToSubdirectoriesOnStartup": false,
    "UseUnsafeLoadAssembly": true,
    "UsePluginsShadowCopy": false
  },
  "CommonConfig": {
    "DisplayFullErrorStack": false,
    "UserAgentStringsPath": "~/App_Data/browscap.xml",
    "CrawlerOnlyUserAgentStringsPath": "~/App_Data/browscap.crawlersonly.xml",
    "UseSessionStateTempDataProvider": false,
    "MiniProfilerEnabled": false,
    "ScheduleTaskRunTimeout": null,
    "StaticFilesCacheControl": "public,max-age=31536000",
    "SupportPreviousNopcommerceVersions": true,
    "PluginStaticFileExtensionsBlacklist": ""
  }
}
1 week ago
What version of nopCommerce are you using?

Did you ... Check your System > Log to see if you're getting other DB errors (e.g., Timeouts)
1 week ago
No any kind of DB error