EldoS | Feel safer!

Software components for data protection, secure storage and transfer

MCSocketTransport.Active hangs

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#3330
Posted: 07/10/2007 17:22:34
by Chris Yourch (Basic support level)
Joined: 06/28/2007
Posts: 7

Why would setting MCSocketTransport.Active = false cause my application to hang?

I am running a variation of the .NET SendNote app under Windows XP SP2.
#3334
Posted: 07/11/2007 01:13:59
by Eugene Mayevski (EldoS Corp.)

The issue happens because the secondary threads can't be shut down for some reason.

One of the reasons would be that on your system UDP messages sent to 127.0.0.1 are blocked. This does happen on some systems and this is totally incompatible with MsgConnect.

The other reason is that the locally sent UDP message is lost. I can't imagine, how this would happen, though.

Please ensure that you are using the latest build of MsgConnect (1.5.7.58, on the site).


Sincerely yours
Eugene Mayevski
#12757
Posted: 03/10/2010 05:44:11
by Ian  (Basic support level)
Joined: 02/23/2010
Posts: 26

Hi,

I'm using the latest C++ build and I get the same problem - gets stuck in the Sleep(10) loop waiting for the secondary thread.

I was just testing - immediately after a successful connect, I terminate the server, and in the Disconnect callback function, I call transport->setActive(false) and it goes into the infinite loop waiting for the thread to die...

I checked the firewall settings and it's definitely set ON for 127.0.0.1 UDP...

I occassionally get a similar problem on Windows Mobile as well...
#12784
Posted: 03/14/2010 03:01:36
by Eugene Mayevski (EldoS Corp.)

I apologize for the late reply. Try reproducing the issue with SendNote sample. If it exposes the same problem unmodified, then the issue is specific to your computer. If it doesn't, then please find a way to reproduce the erroneous behavior.

We have a plan to rework the code in order to get rid of UDP for notifications. Pascal code package already includes these changes, and now we need to propagate them to other code packages.


Sincerely yours
Eugene Mayevski
#12785
Posted: 03/14/2010 07:42:17
by Ian  (Basic support level)
Joined: 02/23/2010
Posts: 26

No problems with SendNote - I can start/stop any time. But I'm using client/server mode...

It seems in MCInetTransport::DoSetActive(void) when I run SendNote demo, FListenerJob is non NULL, so the line:

if (if (FListenerJob)
FThreadPool.FinalizeJob(FListenerJob);

evaluates to true and the threadpool is cleared. But in my app, FListenerJob is NULL, so FinalizeJob doesn't get called, and there is always 1 thread remaining...

I pretty much copied your code to init MessageConnect, the only real difference is that I'm running in stmClient and stmServer modes... and I set the OnDisconnect callback. Perhaps I shouldn't call setActive(false) during this callback? The purpose was to turn off the transport on disconnect to immediately stop any pending sends...
#12786
Posted: 03/14/2010 08:07:22
by Eugene Mayevski (EldoS Corp.)

Quote
Ian wrote:
I pretty much copied your code to init MessageConnect, the only real difference is that I'm running in stmClient and stmServer modes... and I set the OnDisconnect callback. Perhaps I shouldn't call setActive(false) during this callback?


Obviously you have a deadlock!


Sincerely yours
Eugene Mayevski
#12787
Posted: 03/14/2010 08:19:34
by Ian  (Basic support level)
Joined: 02/23/2010
Posts: 26

Yup - if I PostMessage my main window and then from there call the transport's seActive(false) all is well!

Will have to figure out who's who in the thread zoo....

Thanks!
#12788
Posted: 03/14/2010 08:43:10
by Eugene Mayevski (EldoS Corp.)

OnSocketConnected and OnSocketDisconnected are called from context of the worker thread.


Sincerely yours
Eugene Mayevski
#12798
Posted: 03/15/2010 21:07:56
by Ian  (Basic support level)
Joined: 02/23/2010
Posts: 26

Thanks Eugene - I'm running the main code from the same context so that's why it blocked - doh!


Thanks for the heads up!
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

Topic viewed 5129 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!