More PayPalCommerce problems

4 ay önce
i have 2 problems most associated with PayPalCommerce. One is that it frequently crashes with the following stack trace. the other is the PayPal button only appears sometimes.

In the first case, i have to recycle the apppool or iis itself - PayPalCommerce appears to crash the website - at least according to cloudflare.

in the second case, it could be an issue with load balancing as i don't think that this plug-in is suitable for that scenario. there may be something in cloudflare which prevents communication with paypal but damned if i know what it is.

I will probably have to remove the module which is always implicated with a deadlock. nopcommerce 4.8.

before doing so, are there any remedies? are these dlls nopcommerce or do they belong to another vendor?

An unhandled exception has occurred while executing the request.

Exception:
Nop.Core.NopException: No constructor was found that had all the dependencies satisfied.
---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating Nop.Plugin.Payments.PayPalCommerce.Services.PayPalCommerceServiceManager -> λ:Nop.Plugin.Payments.PayPalCommerce.Services.PayPalCommerceHttpClient -> λ:Nop.Core.Domain.Security.ProxySettings.
---> Microsoft.Data.SqlClient.SqlException (0x80131904): Transaction (Process ID 59) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at Microsoft.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader(Boolean isInternal, Boolean forDescribeParameterEncryption)
   at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderInternal(IAsyncResult asyncResult)
   at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderAsync(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location ---
   at Microsoft.Extensions.Caching.SqlServer.DatabaseOperations.GetCacheItemAsync(String key, Boolean includeValue, IBufferWriter`1 destination, CancellationToken token)
   at Microsoft.Extensions.Caching.SqlServer.SqlServerCache.GetAsync(String key, CancellationToken token)
   at Microsoft.Extensions.Caching.Distributed.DistributedCacheExtensions.GetStringAsync(IDistributedCache cache, String key, CancellationToken token)
   at Nop.Core.Caching.DistributedCacheManager.TryGetItemAsync[T](String key)
   at Nop.Core.Caching.DistributedCacheManager.GetAsync[T](CacheKey key, Func`1 acquire)
   at Nop.Core.Caching.CachingExtensions.Get[T](IStaticCacheManager cacheManager, CacheKey key, Func`1 acquire)
   at Nop.Web.Framework.WebStoreContext.GetCurrentStore()
   at Nop.Web.Framework.Infrastructure.NopStartup.<>c__DisplayClass0_0.<ConfigureServices>b__0(IServiceProvider serviceProvider)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.<ConfigurePipeline>b__2_0(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
ClientConnectionId:411460a9-5996-408f-ba0b-d35c02305c51
Error Number:1205,State:18,Class:13
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
   at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest& request)
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest& request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Nop.Core.Infrastructure.NopEngine.<ResolveUnregistered>b__9_0(ParameterInfo parameter)
   at System.Linq.Enumerable.ArraySelectIterator`2.ToArray()
   at Nop.Core.Infrastructure.NopEngine.ResolveUnregistered(Type type)
   --- End of inner exception stack trace ---
   at Nop.Core.Infrastructure.NopEngine.ResolveUnregistered(Type type)
   at Nop.Services.Plugins.PluginDescriptor.Instance[TPlugin]()
   at System.Linq.Enumerable.ListSelectIterator`2.ToList()
   at Nop.Services.Plugins.PluginService.GetPluginsAsync[TPlugin](LoadPluginsMode loadMode, Customer customer, Int32 storeId, String group)
   at Nop.Services.Plugins.PluginManager`1.LoadAllPluginsAsync(Customer customer, Int32 storeId)
   at Nop.Services.Plugins.PluginManager`1.LoadActivePluginsAsync(List`1 systemNames, Customer customer, Int32 storeId)
   at Nop.Services.Cms.WidgetPluginManager.LoadActivePluginsAsync(Customer customer, Int32 storeId, String widgetZone)
   at Nop.Web.Framework.Factories.WidgetModelFactory.<>c__DisplayClass8_0.<<PrepareRenderWidgetModelAsync>b__2>d.MoveNext()
--- End of stack trace from previous location ---
   at Nop.Core.Caching.PerRequestCacheManager.GetAsync[T](Func`1 acquire, CacheKey cacheKey, Object[] cacheKeyParameters)
   at Nop.Web.Framework.Factories.WidgetModelFactory.PrepareRenderWidgetModelAsync(String widgetZone, Object additionalData, Boolean useCache)
   at Nop.Web.Components.WidgetViewComponent.InvokeAsync(String widgetZone, Object additionalData)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsyncCore(ObjectMethodExecutor executor, Object component, ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentInvoker.InvokeAsync(ViewComponentContext context)
   at Microsoft.AspNetCore.Mvc.ViewComponents.DefaultViewComponentHelper.InvokeCoreAsync(ViewComponentDescriptor descriptor, Object arguments)
   at AspNetCoreGeneratedDocument.Views_Home_Index.ExecuteAsync()
   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.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|30_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|28_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>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.<InvokeFilterPipelineAsync>g__Awaited|20_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.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Nop.Services.Authentication.AuthenticationMiddleware.InvokeAsync(HttpContext context)
   at WebMarkupMin.AspNetCoreLatest.WebMarkupMinMiddleware.InvokeCore(HttpContext context, Boolean useMinification, Boolean useCompression)
   at WebMarkupMin.AspNetCoreLatest.WebMarkupMinMiddleware.InvokeCore(HttpContext context, Boolean useMinification, Boolean useCompression)
   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)
   at Nop.Services.Common.KeepAliveMiddleware.InvokeAsync(HttpContext context, IWebHelper webHelper)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

4 ay önce
Search your System Log for "deadlock", to see if any other occurrences...
Based on the stack tracing, it does not seem that the issue is specifically related to the PayPalCommerce plugin.  Rather, it's just that during Startup / LoadAllPlugins, the SQL deadlock happens.

...
   at Nop.Web.Framework.WebStoreContext.GetCurrentStore()
   at Nop.Web.Framework.Infrastructure.NopStartup.<>c__DisplayClass0_0.<ConfigureServices>b__0(IServiceProvider serviceProvider)
...
   at Nop.Services.Plugins.PluginManager`1.LoadAllPluginsAsync(Customer customer, Int32 storeId)
4 ay önce
Hi!

It looks like you are using MS SQL caching as your distributed caching. If so, try changing it to Redis Synchronized Memory and see if the problem persists.
4 ay önce
changing to redis crashed the website. does anyone know where i can change the cache settings MANUALLY?
4 ay önce
great. another expense to maybe avoid deadlocks.
4 ay önce
i found the app settings where cache is configured. i was missing the redis server.
4 ay önce
i finally got it working. for those who are having trouble finding documentation on configuring redis, this is my method. there may be others, and this one may be wrong for your scenario.

my scenario is using the redis cloud service because i do not want to muck with administering yet another application. i found a free plan - or what appears to be free. can't say that it will be there past today, but fwiw:

1. open a redis cloud account, which automatically creates a database (of only 32mb on the free plan. you can see the pricing on the redis website.)
2. open nopcommerce admin console
3. navigate to App settings
4. scroll to  Distributed Cache Settings.
5. in the drop down select Redis.
6. configure the connection string to the redis server.
7. go to the redis console, click on the Subscriptions link in the left menu.
8. scroll to the Public Endpoint; copy it.
9. return to nopcommerce admin panel. replace the localhost string with your public endpoint
10. go back to redis console. scroll down further on the page to find the Default user password. (it is under Security.) copy it.
11. go back to nopcommerce. after the public endpoint add ,<your password>. remove ssl=False.
12. save. the website restarts. if you did something to cause the application to completely crap out (as i did), go to your server to edit appsettings.json. locate the DistributedCacheConfig section and delete it, restart your site, and try again.
13. if all goes well, your application will come to life.
14. then go back to the App settings section to change the distributed cache to Redis Synchronized Memory. save and the application will restart.

if all goes well, your new cache provider will function as will your website. my site really turned zippy compared to the sql server cache i was using. i mean real zippy.

i have no idea if this will resolve the database deadlocks. time will tell.

if you have a lot of data, you may quickly disqualify for free. for example, if you store images in the db or your catalog is large, or you have a lot of traffic, etc etc etc etc...world without end....

ps - cloudflare speed test gave the site 99 which is only 1 point higher than it was in the last assessment.
4 ay önce
If you have chosen the Redis Synchronized Memory caching type, there will be no problems with the 32mb free plan. The thing is that this type of caching uses Redis only as a synchronizer, and all cache data is stored in the memory of a specific server and not in Redis itself
4 ay önce
today's cloudflare speed test is 100. yay. and no deadlocks. double yay.
4 ay önce
after 1 week, no deadlocks. this is exciting. i haven't seen a week of no deadlocks in months. so the redis solution appears to be very effective.