We had the same issue again recently and upon analyzing the logs I found this:
Case 1
2019-03-05 19:05:16.898: Starting processing users.
2019-03-05 19:05:16.930: Starting processing users.
2019-03-05 19:05:17.008: Handling users
2019-03-05 19:05:47.100: Users index builder experienced a fatal error.. System.IO.IOException: The process cannot access the file 'c:\Domains\Sites\componenthardware.com\Files\System\Diagnostics\Secondary users\Users.index\Users\2019-03-05 190510\Status.xml' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync) at System.Xml.XmlWriterSettings.CreateWriter(String outputFileName) at System.Xml.Linq.XDocument.Save(String fileName, SaveOptions options) at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.ProcessUsers() at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.Build(IIndexWriter writer, Tracker tracker)
2019-03-05 19:05:47.100: Users index builder experienced a fatal error.
2019-03-05 19:05:47.303: Failed (10 / 10738).
2019-03-05 19:05:47.303: Closing index writer.
2019-03-05 19:05:47.631: Closed index writer.
Case 2
2019-03-05 19:05:16.180: Opening index writer.
2019-03-05 19:05:16.336: Opened index writer
2019-03-05 19:05:16.773: Opening database connection.
2019-03-05 19:05:47.084: Users index builder experienced a fatal error.. System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() at System.Data.SqlClient.TdsParserStateObject.TryReadByteArray(Byte[] buff, Int32 offset, Int32 len, Int32& totalRead) at System.Data.SqlClient.TdsParserStateObject.TryReadChar(Char& value) at System.Data.SqlClient.TdsParser.TryReadPlpUnicodeCharsChunk(Char[] buff, Int32 offst, Int32 len, TdsParserStateObject stateObj, Int32& charsRead) at System.Data.SqlClient.TdsParser.TryReadPlpUnicodeChars(Char[]& buff, Int32 offst, Int32 len, TdsParserStateObject stateObj, Int32& totalCharsRead) at System.Data.SqlClient.TdsParser.TryReadSqlStringValue(SqlBuffer value, Byte type, Int32 length, Encoding encoding, Boolean isPlp, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj, SqlCommandColumnEncryptionSetting columnEncryptionOverride, String columnName) at System.Data.SqlClient.SqlDataReader.TryReadColumnInternal(Int32 i, Boolean readHeaderOnly) at System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32 i, Boolean setTimeout, Boolean allowPartiallyReadColumn) at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i) at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.ProcessUsers() at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.Build(IIndexWriter writer, Tracker tracker) ClientConnectionId:b00a9f3f-01b3-4d5e-98d5-9a3f79021811 Error Number:-2,State:0,Class:11
2019-03-05 19:05:47.084: Users index builder experienced a fatal error.
2019-03-05 19:05:47.303: Failed.
2019-03-05 19:05:16.180: Opening index writer.
2019-03-05 19:05:16.336: Opened index writer
2019-03-05 19:05:16.773: Opening database connection.
2019-03-05 19:05:47.084: Users index builder experienced a fatal error.. System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() at System.Data.SqlClient.TdsParserStateObject.TryReadByteArray(Byte[] buff, Int32 offset, Int32 len, Int32& totalRead) at System.Data.SqlClient.TdsParserStateObject.TryReadChar(Char& value) at System.Data.SqlClient.TdsParser.TryReadPlpUnicodeCharsChunk(Char[] buff, Int32 offst, Int32 len, TdsParserStateObject stateObj, Int32& charsRead) at System.Data.SqlClient.TdsParser.TryReadPlpUnicodeChars(Char[]& buff, Int32 offst, Int32 len, TdsParserStateObject stateObj, Int32& totalCharsRead) at System.Data.SqlClient.TdsParser.TryReadSqlStringValue(SqlBuffer value, Byte type, Int32 length, Encoding encoding, Boolean isPlp, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TryReadSqlValue(SqlBuffer value, SqlMetaDataPriv md, Int32 length, TdsParserStateObject stateObj, SqlCommandColumnEncryptionSetting columnEncryptionOverride, String columnName) at System.Data.SqlClient.SqlDataReader.TryReadColumnInternal(Int32 i, Boolean readHeaderOnly) at System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32 i, Boolean setTimeout, Boolean allowPartiallyReadColumn) at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i) at System.Data.SqlClient.SqlDataReader.GetValue(Int32 i) at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.ProcessUsers() at Dynamicweb.Security.UserManagement.Indexing.UserIndexBuilder.Build(IIndexWriter writer, Tracker tracker) ClientConnectionId:b00a9f3f-01b3-4d5e-98d5-9a3f79021811 Error Number:-2,State:0,Class:11
2019-03-05 19:05:47.084: Users index builder experienced a fatal error.
2019-03-05 19:05:47.303: Failed.
Would either of these exceptions explain why the file gets in a corrupt or "never built" state? Any chance these issues can be reproduced?
I can understand why we could get a SQL timeout and I think we should work on preventing that from happening in the first place on our end. But I'm not sure I understand why the diagnostics file would be locked though. Is there a way to turn of diagnostics so we can see if that makes the problem go away?
Thanks!
Imar