Skip to content

Commit 20b6840

Browse files
committed
Bug#23104498 SERVER CRASHES AFTER CREATION OF ~524288 (2^19) TABLES.
Problem The server crashes while allocating an index stat, after 2^20 indexes. This happens when the index buffer, of size 1024*1024, is full. The crash happens in PFS_buffer_scalable_container::allocate(), while using pages beyond the end of the m_pages[PFS_PAGE_COUNT] array. The root cause is PFS_buffer_scalable_container::init(), which can compute a value of m_max_page_count that exceeds PFS_PAGE_COUNT. Solution When PFS_buffer_scalable_container::init() is called for a max size that exceeds the buffer total capacity, trim down m_max_page_count to PFS_PAGE_COUNT, as this is the effective max number of pages that can be used.
1 parent c661246 commit 20b6840

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

storage/perfschema/pfs_buffer_container.h

+9
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,22 @@ class PFS_buffer_scalable_container
445445
}
446446
/* Bounded allocation. */
447447
m_full= false;
448+
449+
if (m_max_page_count > PFS_PAGE_COUNT)
450+
{
451+
m_max_page_count= PFS_PAGE_COUNT;
452+
m_last_page_size= PFS_PAGE_SIZE;
453+
}
448454
}
449455
else
450456
{
451457
/* max_size = -1 means unbounded allocation */
452458
m_full= false;
453459
}
454460

461+
DBUG_ASSERT(m_max_page_count <= PFS_PAGE_COUNT);
462+
DBUG_ASSERT(m_last_page_size <= PFS_PAGE_SIZE);
463+
455464
native_mutex_init(& m_critical_section, NULL);
456465
return 0;
457466
}

0 commit comments

Comments
 (0)