Link to home
Start Free TrialLog in
Avatar of shuklasunil
shuklasunil

asked on

My application is having issue with Windows Vista

I have multithreaded MFC application that uses secure socket. The application is running perfectly in XP. But abruptly crashes in Vista (though not always). It crashes when the application calls SSL_library_init. The stack trace shows this crashes at realloc/malloc deep within the SSL_library_init function. The weird thing about this issue is that I can only reproduce in release binary, never in debug or using some tool like boundschecker.
This made be think that this is a timing issue and I added two seconds delay before SSL_library_init, the issue disappeared. Suspecting the previous running instance has not released the socket, I observed the use of socket, but that doesnt looks likely.

I would like to get to the root of it and not able to get the lead. This application is not using more than 22MB, since its known that WIN32 only gets 32MB to work on Vista.
Avatar of DanRollins
DanRollins
Flag of United States of America image

SSL_library_init must be called (and return :-) before *any* other OpenSSL functions.  Is there a chance that some worker thread or something is assuming that it has already been called?
Avatar of shuklasunil
shuklasunil

ASKER

Than why doesn't it crashes when I add two seconds delay before SSL_library_init. In that case this other thread, that we think, calls OpenSSL before SSL_library_init in more likely be excuted before.

Also if I comment  SSL_library_init the code never crashes.
I can't think of anything obvious.  
Are you using the latest version of OpneSSL?  After all, Vista is a relatively new OS... if bugs relating to it exist, they would be fixed onnly in recent versions.
I am using OpenSSL and I am having issue even with the latest version
The main reason that a Release build fails while a Debug build works is that some variable or buffer is not being initialized in code (the Debug version presets them to defined values).  So check all variables that you are passinging into the OpenSSL functions.
Ok I am using the workaround of sleeping for few second.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial