OpenPerpetuum / PerpetuumServer

The Open Perpetuum Project's fork of the Perpetuum Standalone Server
https://openperpetuum.com
Other
44 stars 21 forks source link

Unhandled uniqueness check on new channel? #266

Open MikeJeffers opened 3 years ago

MikeJeffers commented 3 years ago
[09:04:41] ERR 
Exception Found:
Type: System.Data.SqlClient.SqlException
Message: Violation of UNIQUE KEY constraint 'IX_channels_name'. Cannot insert duplicate key in object 'dbo.channels'. The duplicate key value is (**REDACTED**).
The statement has been terminated.
Source: .Net SqlClient Data Provider
Stacktrace:    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteScalar()
   at Perpetuum.Data.DbQuery.<>c__11`1.<ExecuteScalar>b__11_0(IDbCommand cmd)
   at Perpetuum.Data.DbQuery.ExecuteHelper[T](Func`2 execute)
   at Perpetuum.Data.DbQuery.ExecuteScalar[T]()
   at Perpetuum.Services.Channels.ChannelRepository.Insert(Channel channel)
   at Perpetuum.Services.Channels.ChannelManager.CreateChannel(ChannelType type, String name)
   at Perpetuum.RequestHandlers.Channels.ChannelCreate.HandleRequest(IRequest request)
   at Perpetuum.Profiler.ExecutionTimeOf(Action action)
   at Perpetuum.Host.Requests.RequestHandlerProfiler`1.HandleRequest(T request)
   at Perpetuum.Services.Sessions.Session.OnDataReceived(ITcpConnection connection, Byte[] receivedData)
naHrej commented 3 years ago

I wasn't able to replicate this one. Looking ChannelCreate.cs on line 23 it looks as though the uniqueness check is handled and I was presented with a tidy error message in the console. Is there a specific circumstance where this one is happening?

MikeJeffers commented 3 years ago

I also failed to replicate it, but this was caught on live. I assume it is on channel create or some race with another channel command which might not be in a transaction or something.

aqpanaciy commented 2 years ago

Figured out how to reproduce this problem. Use the name of an existing chat. Change the case of letters in its name.

image