MDEV-28995 Sporadic Assertion on shutdown in threadpool_winsockets.cc

Remove the affected assert.
Wait for all AIO_buffer_cache::release_buffer() to finish before
AIO_buffer_cache::clear().
This commit is contained in:
Vladislav Vaintroub 2022-07-01 13:04:44 +02:00
parent 90792e4a43
commit ba3354fca6

View File

@ -114,8 +114,17 @@ void AIO_buffer_cache::clear()
if (!m_base)
return;
/* Check that all items are returned to the cache. */
DBUG_ASSERT(m_cache.size() == m_elements);
std::unique_lock<std::mutex> lk(m_mtx, std::defer_lock);
for(;;)
{
if (lk.try_lock())
{
if (m_cache.size() == m_elements)
break;
lk.unlock();
}
Sleep(100);
}
VirtualFree(m_base, 0, MEM_RELEASE);
m_cache.clear();
m_base= 0;