News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
Unexplained hang in new SecureTcpListener  
by Stuart Ballard
posted on 2003/10/30

I have a strange hang in a program I'm writing using the SSL libraries. I have code that looks like this (after adding lots of debugging logging...)

try {
SecurityOptions opts = new SecurityOptions(SecureProtocol.Tls1);
opts.Certificate = HMMService.ClientCert;
Log("Got cert");
opts.VerificationType = CredentialVerification.None;
opts.Entity = ConnectionEnd.Server;
SecureTcpListener listener = new SecureTcpListener(9999, opts);
Log("Listener created");
listener.Start();
Log("Listener started");
} catch (Exception e) {
Log(e.ToString());
}

The code consistently does output "Got cert" but doesn't makes it as far as "Listener created". It also doesn't log any exception, which means it must either be somehow aborting from my code without throwing an exception, or it's just hanging. Bizarrely, this code (pretty much unchanged) used to work, and all the changes I made (except for adding the debugging) were in completely unrelated code - I'm having a hard time figuring out why it would be breaking now when it wasn't before.

I have this same code (listening on different ports) running in two separate threads, but I've ensured that they're using completely separate cert objects just to be safe, and the problem still occurs. Are there any fundamental thread-safety issues in the SSL code that might cause this? Any other ideas as to what could be going on?

Thanks in advance for any help you can give me.

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2003/10/31

It have a feeling that the problem you're seeing is not related to the security library. If you follow the code in the SecureTcpListener(int, SecOpts) constructor, you'll see that it doesn't do any processing whatsoever. All it does is assign the two constructor parameters to two private class variables. I don't see where it could lock up and I don't see any potential threading issues.

You mention that the problems started when you added the logging code. Are you sure your Log class is thread safe [or are you sure it doesn't have other problems]? [I assume that both threads are using the same Log instance]
Have you tried removing the Log code to see if it works again?

by Stuart Ballard
posted on 2003/11/03

You were right - moral of the story, if you are trying to log exceptions, make SURE that your log code doesn't throw an exception itself :)

Sorry for wasting your time :)

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.