[MXS-4921] Memory growth for long-running sessions that use prepared statements Created: 2024-01-09  Updated: 2024-02-02  Resolved: 2024-01-15

Status: Closed
Project: MariaDB MaxScale
Component/s: Core
Affects Version/s: 6.4.13, 22.08.11, 23.02.8, 23.08.4
Fix Version/s: 6.4.14, 22.08.12, 23.02.9, 23.08.5

Type: Bug Priority: Critical
Reporter: markus makela Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
includes MXS-4922 Memory growth for long-running sessio... Closed

 Description   

Whenever a "session command" is executed, the response type (success or failure) is stored to know when a backend has diverged and must be discarded. Normally these are removed when the history overflows and pruning takes place. The exception to this is when a tight loop of COM_STMT_PREPARE and COM_STMT_CLOSE is done: the history is pre-emptively pruned when the COM_STMT_CLOSE arrives to remove the COM_STMT_PREPARE for the about-to-be-closed statement from the history. This way the history remains a complete set of commands that can be executed as a batch.

The problem arises from the fact that the history responsese are only pruned when the history overflows. With the COM_STMT_PREPARE -> COM_STMT_CLOSE loop, the normal pruning never takes place and the history responses keep on being stored. This can be verified by memory usage profiling and by looking up whether MariaDBClientConnection::finish_recording_history() shows up as one of the top functions.

The solution to this is to also erase the history response whenever the history is modified.


Generated at Thu Feb 08 04:32:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.