Open davidchan9x opened 1 year ago
I am guessing you have connection issue to from the web server to the sql server. What you should do is enable the Mini Profiler feature and see each query being executed along with duration so you can identify the bottleneck.
I am guessing you have connection issue to from the web server to the sql server. What you should do is enable the Mini Profiler feature and see each query being executed along with duration so you can identify the bottleneck.
sql server crashes only when doing automatic cloning of blogpost records using culr command, i think too many connections were opened to sqlserver, orchard core doesn't automatically close connections after inserting into records sqlserver. When I stop the above clone command, sqlserver is no longer slow. This is a bug that I think orchard core needs to investigate and fix. vps 2 core 4 ram no one has access, only I tested it. I run the *"SELECT COUNT() FROM [cms].[dbo].[cms_ContentItemIdex]"** statement directly on sqlserver management which is also slow
When cookies and tokens expire but still run the above clone command with the culr website command, you will get error 502, this is a dangerous error that can be exploited to attack security holes and crash websites using orchard core.
I found the error, probably due to opening multiple sqlserver pool connections when automatically adding many blogpost records. Can orchard core fix this error?
Also worth noting is that if you're investigating such an issue, don't try to performance test it with 100k requests being issued to your site on DotNest ;).
Please report these "security issues" directly to @sebastienros Look at the readme.md file. I think we should close the topic.
@Piedone I didn't rent a tester on DotNest.net, I rented a 2 core 4gb vps to test, and I was the only one testing with no visitors. The culr command to clone records is a normal command, not 100k requests like you said. . The problem here is that pooling was overloaded, sql pooling was not closed after cloning, so the clone continued to open the pool again, so sqlserver overloaded the pool (even though the cpu was only used at 49%) leading to the error. 502 nginx.
@Skrypt I test clone or add blogpost automatically so that I can later transfer all my data from the old website to the new orchard core technology. But after cloning or automatically adding products for a while, pooling overload results in slow sqlserver and 502 nginx. This is an error that needs to be fixed.
I just added 1 blogpost, then I turned on f12 copy culr, then ran the command for do culr in ubuntu. After cloning for 4-5 minutes, orchard core continues to get error 502 nginx.
You did hammer your site site on DotNest with requests, but I digress.
You did hammer your site site on DotNest with requests, but I digress.
Oh, I tried installing a website on DotNest to test clone records to see if it was slow and had 502 nginx errors like me (I rented a 2 core 4 gb vps to test the clone and also had slow web access and 502 nginx errors), I have no intention of DDOSing anything. Because I want to transfer my data to Orchard core, but when cloning or adding blogpost records automatically, I get slow access and 502 nginx errors. I guess the sqlserver polling is overflowing and overloaded (Due to not closing the sql connection when completing the culr clone command or adding 1 blogpost record)
Do your tests locally, not on a public server. The responsible way is to inform @piedone to get approval first. Thanks.
@Skrypt Sorry, I will learn from experience, ( I tested locally and on a 2 core 4gb vps and also had slow web access and a 502 nginx error so I tested further on DotNest.) I just want to see if I installed something wrong or if DotNest also has the same error as me when cloning or adding a blogpost record continuously (Because later I transfer data from On sang's website, I am also ready to automatically add records to orchard core)..I have just joined and learned about orchard core for 1 month, I have already received an email from @Piedone notifying me.
This is my error log file on orchard core.
After continuing testing, orchard localhost + sqlserver vps, orchard vps + sqlserver vps. When executing the culr command to automatically add blogpost records on the vps, the orchard core vps gets error 502, but when I run the code localhost + sqlserver 2022, the code runs normally without any problems => proving that the sqlserver vps is not erroring, the error is due to orchard core vps, but I checked the vps 2 core 4gb ram and only used up 40% of the cpu, the ram has 2.2GB left, the vps is still full load.
Log Error 502 nginx :
2023-11-30 15:32:59.8389||||Microsoft.Hosting.Lifetime|INFO|Application is shutting down...
2023-11-30 15:33:00.4364|Default|00-b1b88e78423a2ea58b16d948a663408c-9205e418d8543f0d-00||OrchardCore.ContentManagement.Handlers.ContentPartHandlerCoordinator|ERROR|IContentPartHandler thrown from OrchardCore.Autoroute.Handlers.AutoroutePartHandler by SqlException Microsoft.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 2 - Connection was terminated: Connection was terminated)
at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 459
at YesSql.Store.ProduceAsync[T,TState](WorkerQueryKey key, Func`2 work, TState state)
at YesSql.Services.DefaultQuery.Query`1.ListImpl()
at YesSql.Services.DefaultQuery.Query`1.ListImpl()
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.IsAbsolutePathUniqueAsync(String path, String contentItemId) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 479
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.GenerateUniqueAbsolutePathAsync(String path, String contentItemId) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 460
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.GenerateContainerPathFromPatternAsync(AutoroutePart part) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 420
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.UpdatedAsync(UpdateContentContext context, AutoroutePart part) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 141
at OrchardCore.Modules.InvokeExtensions.InvokeAsync[TEvents,T1,T2](IEnumerable`1 events, Func`4 dispatch, T1 arg1, T2 arg2, ILogger logger) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore\OrchardCore.Abstractions\Modules\Extensions\InvokeExtensions.cs:line 158
ClientConnectionId:87ad51d1-6992-4bb9-b9e9-828e7436ed49 at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 459
at YesSql.Store.ProduceAsync[T,TState](WorkerQueryKey key, Func`2 work, TState state)
at YesSql.Services.DefaultQuery.Query`1.ListImpl()
at YesSql.Services.DefaultQuery.Query`1.ListImpl()
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.IsAbsolutePathUniqueAsync(String path, String contentItemId) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 479
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.GenerateUniqueAbsolutePathAsync(String path, String contentItemId) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 460
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.GenerateContainerPathFromPatternAsync(AutoroutePart part) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 420
at OrchardCore.Autoroute.Handlers.AutoroutePartHandler.UpdatedAsync(UpdateContentContext context, AutoroutePart part) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Autoroute\Handlers\AutoroutePartHandler.cs:line 141
at OrchardCore.Modules.InvokeExtensions.InvokeAsync[TEvents,T1,T2](IEnumerable`1 events, Func`4 dispatch, T1 arg1, T2 arg2, ILogger logger) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore\OrchardCore.Abstractions\Modules\Extensions\InvokeExtensions.cs:line 158
2023-11-30 15:33:00.4497|Default|00-b1b88e78423a2ea58b16d948a663408c-9205e418d8543f0d-00|1|Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware|ERROR|An unhandled exception has occurred while executing the request. Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
---> System.Net.Sockets.SocketException (104): Connection reset by peer
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.Data.SqlClient.SNI.SNITCPHandle.Receive(SNIPacket& packet, Int32 timeoutInMilliseconds)
at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParserStateObject.ThrowExceptionAndWarning(Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at Microsoft.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
at Microsoft.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
at Microsoft.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(SqlConnectionEncryptOption encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean& marsCapable, Boolean& fedAuthRequired, Boolean tlsFirst)
at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnectionString connectionOptions, Boolean withFailover)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool)
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.InternalOpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at YesSql.Session.CreateConnectionAsync()
at YesSql.Session.SaveEntityAsync(Object entity, String collection)
at YesSql.Session.FlushAsync()
at YesSql.Session.FlushAsync()
at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
at OrchardCore.ContentManagement.DefaultContentManager.PublishAsync(ContentItem contentItem) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore\OrchardCore.ContentManagement\DefaultContentManager.cs:line 446
at OrchardCore.Contents.Controllers.AdminController.<CreateAndPublishPOST>b__21_0(ContentItem contentItem) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Contents\Controllers\AdminController.cs:line 379
at OrchardCore.Contents.Controllers.AdminController.CreatePOST(String id, String returnUrl, Boolean stayOnSamePage, Func`2 conditionallyPublish) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Contents\Controllers\AdminController.cs:line 647
at OrchardCore.Contents.Controllers.AdminController.CreateAndPublishPOST(String id, String submitPublish, String returnUrl) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Contents\Controllers\AdminController.cs:line 380
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>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.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker 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__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at OrchardCore.Seo.Services.RobotsMiddleware.Invoke(HttpContext httpContext) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Seo\Services\RobotsMiddleware.cs:line 65
at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at OrchardCore.Apis.GraphQL.GraphQLMiddleware.Invoke(HttpContext context, IAuthorizationService authorizationService, IAuthenticationService authenticationService, ISchemaFactory schemaService, IDocumentWriter documentWriter) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Apis.GraphQL\GraphQLMiddleware.cs:line 71
at OrchardCore.Liquid.ScriptsMiddleware.Invoke(HttpContext httpContext) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Liquid\ScriptsMiddleware.cs:line 71
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<<Configure>b__1>d.MoveNext() in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Diagnostics\DiagnosticsStartupFilter.cs:line 47
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
ClientConnectionId:2e8c7b41-4478-4bfa-ae41-2962af53f17a at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParserStateObject.ThrowExceptionAndWarning(Boolean callerHasConnectionLock, Boolean asyncClose)
at Microsoft.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at Microsoft.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
at Microsoft.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
at Microsoft.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(SqlConnectionEncryptOption encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean& marsCapable, Boolean& fedAuthRequired, Boolean tlsFirst)
at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnectionString connectionOptions, Boolean withFailover)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool)
at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.InternalOpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at YesSql.Session.CreateConnectionAsync()
at YesSql.Session.SaveEntityAsync(Object entity, String collection)
at YesSql.Session.FlushAsync()
at YesSql.Session.FlushAsync()
at YesSql.Services.DefaultQuery.Query`1.FirstOrDefaultImpl()
at OrchardCore.ContentManagement.DefaultContentManager.PublishAsync(ContentItem contentItem) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore\OrchardCore.ContentManagement\DefaultContentManager.cs:line 446
at OrchardCore.Contents.Controllers.AdminController.<CreateAndPublishPOST>b__21_0(ContentItem contentItem) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Contents\Controllers\AdminController.cs:line 379
at OrchardCore.Contents.Controllers.AdminController.CreatePOST(String id, String returnUrl, Boolean stayOnSamePage, Func`2 conditionallyPublish) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Contents\Controllers\AdminController.cs:line 647
at OrchardCore.Contents.Controllers.AdminController.CreateAndPublishPOST(String id, String submitPublish, String returnUrl) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Contents\Controllers\AdminController.cs:line 380
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>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.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker 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__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at OrchardCore.Seo.Services.RobotsMiddleware.Invoke(HttpContext httpContext) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Seo\Services\RobotsMiddleware.cs:line 65
at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at OrchardCore.Apis.GraphQL.GraphQLMiddleware.Invoke(HttpContext context, IAuthorizationService authorizationService, IAuthenticationService authenticationService, ISchemaFactory schemaService, IDocumentWriter documentWriter) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Apis.GraphQL\GraphQLMiddleware.cs:line 71
at OrchardCore.Liquid.ScriptsMiddleware.Invoke(HttpContext httpContext) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Liquid\ScriptsMiddleware.cs:line 71
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at OrchardCore.Diagnostics.DiagnosticsStartupFilter.<>c__DisplayClass3_0.<<Configure>b__1>d.MoveNext() in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Diagnostics\DiagnosticsStartupFilter.cs:line 47
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)
2023-11-30 15:33:00.4775|Default|00-b1b88e78423a2ea58b16d948a663408c-9205e418d8543f0d-00||OrchardCore.Environment.Shell.Scope.ShellScope|ERROR|Error while processing deferred task 'System.Func`2[[OrchardCore.Environment.Shell.Scope.ShellScope, OrchardCore.Abstractions, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null],[System.Threading.Tasks.Task, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' on tenant 'Default'. Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)
---> System.IO.IOException: Unable to read data from the transport connection: Connection reset by peer.
---> System.Net.Sockets.SocketException (104): Connection reset by peer
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at Microsoft.Data.SqlClient.SNI.SNITCPHandle.Receive(SNIPacket& packet, Int32 timeoutInMilliseconds)
at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.InternalOpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at OrchardCore.Indexing.Services.IndexingTaskManager.FlushAsync(ShellScope scope, IEnumerable`1 tasks) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Indexing\IndexingTaskManager.cs:line 161
at OrchardCore.Environment.Shell.Scope.ShellScope.<>c__DisplayClass53_0.<<BeforeDisposeAsync>b__0>d.MoveNext() in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 443
ClientConnectionId:2e8c7b41-4478-4bfa-ae41-2962af53f17a at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.InternalOpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at OrchardCore.Indexing.Services.IndexingTaskManager.FlushAsync(ShellScope scope, IEnumerable`1 tasks) in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore.Modules\OrchardCore.Indexing\IndexingTaskManager.cs:line 161
at OrchardCore.Environment.Shell.Scope.ShellScope.<>c__DisplayClass53_0.<<BeforeDisposeAsync>b__0>d.MoveNext() in C:\Users\Admin\Downloads\OrchardCore-1.7.2\OrchardCore-1.7.2\src\OrchardCore\OrchardCore.Abstractions\Shell\Scope\ShellScope.cs:line 443
2023-11-30 15:33:59.9165|||50|Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository|WARN|Using an in-memory repository. Keys will not be persisted to storage.
2023-11-30 15:34:00.0356|||59|Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager|WARN|Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
2023-11-30 15:34:00.0976|||35|Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager|WARN|No XML encryptor configured. Key {5c7b205a-afd5-4f50-a099-2e790e3ed009} may be persisted to storage in unencrypted form.
2023-11-30 15:34:00.1793|||14|Microsoft.Hosting.Lifetime|INFO|Now listening on: http://localhost:5000
2023-11-30 15:34:00.1827||||Microsoft.Hosting.Lifetime|INFO|Application started. Press Ctrl+C to shut down.
2023-11-30 15:34:00.1827||||Microsoft.Hosting.Lifetime|INFO|Hosting environment: Production
2023-11-30 15:34:00.1827||||Microsoft.Hosting.Lifetime|INFO|Content root path: /var/www/aspnetcore/linu
We should try it locally and monitor the number of open connections. I don't think the script that was provided as repro steps is concurrent, so I would assume that the resource should be disposed on the go.
If we see something growing indefinitely then it could show there is something wrong.
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).
This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.
https://github.com/OrchardCMS/OrchardCore/assets/152346391/b7a90018-101f-4814-90b1-4609590610e8
Frontend, admin access is very slow (5-20s when accessing homepage, tags, category ...) when I clone blogpost posts automatically to test by running culr, I have cloned 9.9 thousand blogpost records.
When I'm cloning with the culr command, accessing the home page, taxonomy (tag, category...) is very slow and sometimes takes 5-10 seconds to access. My cpu is 2cpu with 4GB ram and I check the cpu before it works. I still have 50% CPU left. When I stop running the culr command, I don't get the frontend slow access error anymore. But when the cookies expire, I can't clone but I still intentionally run the above clone command and I get the error 502 nginx (vps 2 core 4 ram no one has access, only I tested it) - vps : ubuntu 20.04, sqlserver 2022
I accessed sqlserver and tried the following query, it took > 10 seconds to complete the query, orchard core when I cloned records continuously with the culr command, it slowed down sqlserver a lot, which caused the problem. The website is so slow (because sqlserver queries take a lot of time)
*SELECT COUNT() FROM [cms].[dbo].[cms_ContentItemIdex]**
When cookies and tokens expire but still run the above clone command with the culr website command, you will get error 502, this is a dangerous error that can be exploited to attack security holes and crash websites using orchard core.
(https://github.com/OrchardCMS/OrchardCore/assets/152346391/80420b94-2f52-476b-8552-f4f927314581)
I found the error, probably due to opening multiple sqlserver pool connections when automatically adding many blogpost records. Can orchard core fix this error?
done