Question:
Hello.
I am created network application based to synchronous CkSocketW (Unicode C++). My code - not using CRITICAL_SECTION\Mutex\etc... In range tests show bad TLS performance, i check my application DebugDiag 2 Analysis (Microsoft), he show me next results:
Detected possible blocking or leaked critical section at 0x00000061`bb8b0298 owned by thread 1378 in MyNetworkApp.DMP Impact of this lock 79,18% of threads blocked
Other debuggers show using CRITICAL_SECTION in Chilkat.
Questions:
Small test example:
void CkTlsConnect(std::vector<std::wstring> &ipChunk, int port)
{
for (int i = 0; i < ipChunk.size(); i++)
{
std::wstring ip = ipChunk[i];
if (!ip.empty())
{
CkSocketW socket;
socket.put_SslProtocol(L"TLS 1.0");
socket.put_HeartbeatMs(0);
socket.put_KeepAlive(false);
if (socket.Connect(ip.c_str(), port, true, 5000))
{
socket.put_MaxReadIdleMs(5000);
socket.put_MaxSendIdleMs(5000);
socket.SendByte(0x01);
if (socket.ReceiveByte(true))
{
socket.get_ReceivedInt();
}
socket.Close(0);
}
socket.dispose();
}
}
}
void CkTlsTest()
{
int threadCount = 4000;
std::vector<std::vector<std::wstring>> ipChunks;
//
// getting ip chunks
//
std::vector<std::thread> threadList(threadCount);
for (int i = 0; i < threadCount; i++)
threadList[i] = std::thread(CkTlsConnect, std::ref(ipChunks[i]), 1528);
for (int i = 0; i < threadCount; i++)
threadList[i].join();
}
I am using this Chilkat version: http://chilkatdownload.com/9.5.0.61/chilkat-9.5.0-x86_64-vc12.zip