I am trying to deploy a service that receives fix messages and processes them. It features two components that communicate over the session, a source and a dispatcher. Previously, they both instantiated a new fix session. During my testing, things seemed to work fine since I was only using one of them at a time. Now it has to be deployed but I keep getting this error (and other variants related to quickfix log files etc):
2023-09-05 04:47:34.634 -04:00 [INF] Session created: FIX.4.4:CARROEMSX->BLPEMSXUAT
2023-09-05 04:47:34.644 -04:00 [INF] FIX Session event FIX Bloomberg - EMSX, CL014-UAT, Created session
2023-09-05 04:47:39.548 -04:00 [ERR] Session could not be created. CL014-UAT FIX Bloomberg - EMSX
System.IO.IOException: The process cannot access the file '.\Store\FIX.4.4-CARROEMSX-BLPEMSXUAT.seqnums' because it is being used by another process.
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at POne.Gateway.Fix.FixSessionStore.ConstructFromFileCache()
at POne.Gateway.Fix.FixSessionStore.open()
at POne.Gateway.Fix.FixSessionStore..ctor(String path, SessionID sessionID)
at POne.Gateway.Fix.FixSessionStoreFactory.Create(SessionID sessionID)
at QuickFix.Session..ctor(Boolean isInitiator, IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider, SessionSchedule sessionSchedule, Int32 heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, String senderDefaultApplVerID)
at QuickFix.SessionFactory.Create(SessionID sessionID, Dictionary settings)
at QuickFix.AbstractInitiator.CreateSession(SessionID sessionID, Dictionary dict)
at QuickFix.AbstractInitiator.Start()
at POne.Gateway.Fix.FixSession.Start()
at POne.Gateway.Fix.FixSession.<.ctor>b__22_0()
at POne.Gateway.Extensions.DelegateExtensions.<>c__DisplayClass1_0.<RetryOnError>b__0()
at POne.Gateway.Extensions.DelegateExtensions.RetryOnError[T](Func`1 method, Int32 retryCount, Int32 timeout)
at POne.Gateway.Extensions.DelegateExtensions.RetryOnError(Action method, Int32 retryCount, Int32 timeout)
at POne.Gateway.Fix.FixSession..ctor(String settings)
The first thing I tried was to use a single fix session so it is not implemented as a singleton and every element that is a fix session gets that instance. Still I get this error. I realize that it says "process", but I am not sure what to do about it. The quickfix log file would a similar error, but overwriting the FileLog.cs file to add file share solved that. File share for this file isnt doing anything. FixSessionStore.cs is almost the same as quickfix FileStore.cs but with file share enabled.
The session string is valid and was taken from a version of the service written in old framework. That service works with the session string. I do not think concurrency should be an issue anymore since there is only one instane of the fix session.
Additional info: When two separate sessions were being created, pointing FileStorePath and FileLogPath to different paths would resolve this issue (it had other problems, but not file access).
What am I missing?