[MXS-223] Possible memory leak in gwbuf_alloc Created: 2015-06-25 Updated: 2015-07-16 Resolved: 2015-07-16 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | readwritesplit |
| Affects Version/s: | 1.1.1 |
| Fix Version/s: | 1.2.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Krzysztof Książek | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Hello, I've experienced behavior which points to the memory leak in MaxScale 1.1.1. How to repeat: Decompress attached tarball, download and install pt-log-player from Percona Toolkit 2.1.11 ' | xargs kill -9 ; sleep 4s ; done After a while observe memory utilization growing: Session files contain: root@ip-10-10-90-60:~/maxscale_debug# cat ./sessions/sessions-* | sort | uniq -c MaxScale version: I've attached tarball with session files and massif report. For this test I've used single PXC instance in a readwritesplit router. readconnroute doesn't seem to be affected. |
| Comments |
| Comment by Krzysztof Książek [ 2015-06-25 ] | ||||||||||||||||
|
And here's the relevant output from ms_print:
| ||||||||||||||||
| Comment by markus makela [ 2015-06-26 ] | ||||||||||||||||
|
Are the client sessions to MaxScale ever closed? If not, then this is a case of "session commands" being stored inside MaxScale. You can disable this behavior by adding disable_sescmd_history=true to the router_options parameter of the service. This will disable the storing of queries that modify the state of the session. Here is the relevant documentation: https://github.com/mariadb-corporation/MaxScale/blob/master/Documentation/Getting-Started/Configuration-Guide.md#optional-parameters If possible, please retest this with the session command history disabled. | ||||||||||||||||
| Comment by Krzysztof Książek [ 2015-06-26 ] | ||||||||||||||||
|
I'll check but I'm pretty sure app's not handling session termination correctly. Like, I'd say, 90% of the apps out there... The connection is terminated, though, and I'd expect proxy to clean up the mess the app created. I assume you can track which connections/sessions are open and which were closed. Maybe there is a configurable timeout to force cleansing? Other option will be to change defaults of max_sescmd_history (if I understand correctly it should keep the memory utilization within limits). | ||||||||||||||||
| Comment by markus makela [ 2015-06-26 ] | ||||||||||||||||
|
Yes, this seems to be the case with most of the applications. A large part of them seem to use pooled connections and MaxScale will see them as one long session. MaxScale can be configured to work better with pooled connections. The max_sescmd_history option closes sessions that exceed the set limit. Using this will force the sessions to be recreated which will cause a slight performance drop due to the closing and opening of the session. This is why the disable_sescmd_history option exists. Other ways to enforce limits on sessions is to set the connection_timeout=<seconds> parameter for the service. This will close all sessions which have been idle for too long. | ||||||||||||||||
| Comment by Krzysztof Książek [ 2015-07-03 ] | ||||||||||||||||
|
Markus, just to confirm I'm setting the option correctly. Does this setup of a rwsplit router looks fine to you?
Actually, I've tested setting the disable_sescmd_history=true also outside of the router_options. None of it prevented MaxScale from increasing it's memory footprint. | ||||||||||||||||
| Comment by markus makela [ 2015-07-03 ] | ||||||||||||||||
|
The config looks good, it should prevent the storing of session commands. Did you install MaxScale from a package or build it from source? | ||||||||||||||||
| Comment by Krzysztof Książek [ 2015-07-03 ] | ||||||||||||||||
|
I've installed if from the repo:
| ||||||||||||||||
| Comment by markus makela [ 2015-07-07 ] | ||||||||||||||||
|
I've reproduced one memory leak but it was caused when the pt-log-player failed to execute a query:
This has been fixed but I'll still continue testing for other possible memory leaks. |