1
SmarterMail hard down with "The process cannot access the file" in event log
Problem reported by josh levine - 7/5/2022 at 7:40 AM
Known
Over the holiday weekend my SmarterMail server went down hard (no in/out SMTP/POP3, webmail down) with the following error in the event logs...

```
System.IO.IOException: The process cannot access the file 'f:\SmarterMail\Domains\josh.com\Users\matt\settings.json' 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, Boolean useLongPath, Boolean checkHost)
   at System.IO.File.InternalReadAllBytes(String path, Boolean checkHost)
   at SmarterMail.Common.Files.FileFunctions.ReadFileFromDiskAsBytes(String path)
   at SmarterMail.Common.Files.FileFunctions.ReadJsonFile[T](String path, String cacheBusterKey, Action onLoadFromDisk)
   at SmarterMail.Common.Files.UserFiles.UserSettingsFile.Read(String path, String cacheBusterKey)
   at MailService.Repositories.UserRepository.UserSettingsLoadFile()
   at MailService.Repositories.UserRepository.UserSettingsLoadFileReadOnly()
   at MailService.Repositories.UserRepository.GetUserSettingsReadOnly()
   at MailService.SearchIndex.Indexing.UserIndexCoordinator.<HandleUserLoggedIn>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
```

Restarting the service seems to have gotten everything running again. Any ideas why this would happen and how to prevent it from happening again?

SmarterMail Professional
Build 8125 (Mar 31, 2022)


3 Replies

Reply to Thread
0
echoDreamz Replied
Any AV software or backup software running that could have been trying to access the file with SM?
0
josh levine Replied
No AV. 

Yes Code 42 backup. Hmmm... It is supposed to use VSS but maybe not for these little JSON files that it thinks it can just grab?

2
Matt Petty Replied
Employee Post
Thanks for reporting this. This should not have gotten the file exception but our code also should not have crashed all the way to the service. I'll put in a note to discuss fixing this crash so a file exception won't stop the server in this spot, we can at least fix the crash, anything can cause the FileIO exception.
Matt Petty Software Developer SmarterTools Inc. (877) 357-6278 www.smartertools.com

Reply to Thread