forked from percona/percona-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug#35635853 shutdown plugin core when init_events_waits_history_long…
… failed Problem ======= In some edge cases, when an out of memory condition happens during the performance schema initialization, the server later crashes on cleanup. Root cause ========== The problem is with the internal representation of an array, in the performance schema data buffers. Conceptually, arrays are like a std::span<T> in C++, but the code pre dates C++20 by more than 10 years. For various data types T, the performance schema represents internally an array of T with: - a xxx_array_ptr variable, of type T* - a xxx_array_size variable When an array is not allocated: - xxx_array_ptr == nullptr - xxx_array_size == 0 When an array is allocated: - xxx_array_ptr != nullptr - xxx_array_size != 0 The problem is that on some error path, typically when an allocation fails, the code can leave an inconsistent state, such as: - xxx_array_ptr == nullptr - xxx_array_size != 0 which later confuses code and causes a crash. The same inconsistent state can also exist after cleanup, when the array size is not always reset. Fix === Revised every use of: - PFS_MALLOC_ARRAY, - PFS_FREE_ARRAY, to make sure that the array pointer and the array size are coherent (either both set, or both nullptr / 0). Change-Id: I581a385fc1dc3ee4c2ad516664de6d256649954c
- Loading branch information
Showing
7 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters