Re: [Quickfix-developers] SocketInitiator.stop() Problem
Brought to you by:
orenmnero
From: openshac <cha...@gm...> - 2011-01-12 14:48:54
|
_socketInitiator implements IDisposable. Are you calling _socketInitiator.Dispose(); ? If you don't you may have unmanaged resources (LogFiles) that will not be cleaned up / released / garbage collected correctly. The SocketInitiator.Dispose() method looks like it does this for you if you call it: void Dispose( bool dispose ) { if( m_pUnmanaged ) { stop( true ); delete m_pUnmanaged; m_pUnmanaged = 0; m_application = 0; m_factory = 0; m_logFactory = 0; } if( dispose ) System::GC::SuppressFinalize( this ); } void Dispose() { Dispose( true ); } horus_the_rabbit wrote: > > Thanks! I'll be sure to try that. Explicit GC calls aren't "nice", but > right now my only other option was to disable the test that tests > login/logout and that's no less of a ugly thing to do in testing. > > -Horus > > dc10 wrote: >> >> Hi Horus, >> >> I've been struggling with the same problem. In my case it hangs on >> initiator.stop() too and looking in the debugger shows that it is hanging >> on a thread join in the unmanaged code. >> >> The only way I've reliably been able to get round this is to logout all >> the sessions and then set the initiator variable equal to null and call >> GC.Collect()! >> >> Truly horrendous and I'm not proud but at least I can work around the >> issue for now while i look for a better solution. >> >> Please let me know how you get on >> >> >> horus_the_rabbit wrote: >>> >>> Hi Jason, >>> >>> I was wondering if you ever resolved this or if anyone has a fix. I'm >>> having the exact same issue and I'm using tests to drive my development >>> (TDD) and this is really been annoying me for the past 3 days. >>> >>> Here's what I do: >>> >>> public bool logon() { >>> try { initiator.start(); } >>> catch (ConfigError configError) { >>> Console.Write(configError.StackTrace); >>> return false; >>> } >>> return true; >>> } >>> >>> public void logout() { >>> initiator.stop(); //HANGS HERE AND STOPS DEBUGGER >>> } >>> >>> When running tests, after my first test succeeds and my second test >>> runs, I get this: >>> >>> Failure invoke test setup method >>> QuickFix.ConfigError >>> Configuration failed: Could not open body file: >>> Logs\FIX.4.2-LCG-FXDD-MKD.body >>> Void .ctor(QuickFix.Application, QuickFix.MessageStoreFactory, >>> QuickFix.SessionSettings, QuickFix.LogFactory, QuickFix.MessageFactory) >>> >>> >>> Any help would be greatly appreciated, as I don't want to make a mock >>> obj for this and would rather see it work properly. >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/SocketInitiator.stop%28%29-Problem-tp18473551p30652443.html Sent from the QuickFIX - Dev mailing list archive at Nabble.com. |