Mattermost, Inc.

Mattermost consumes more memory day by day


memleak in mattermost

Steps to reproduce

Configuration file

    "ServiceSettings": {
        "ListenAddress": "",
        "MaximumLoginAttempts": 10,
        "SegmentDeveloperKey": "",
        "GoogleDeveloperKey": "",
        "EnableOAuthServiceProvider": false,
        "EnableIncomingWebhooks": true,
        "EnableOutgoingWebhooks": false,
        "EnableCommands": false,
        "EnableOnlyAdminIntegrations": true,
        "EnablePostUsernameOverride": false,
        "EnablePostIconOverride": true,
        "EnableTesting": false,
        "EnableDeveloper": false,
        "EnableSecurityFixAlert": true,
        "EnableInsecureOutgoingConnections": false,
        "EnableMultifactorAuthentication": false,
        "AllowCorsFrom": "",
        "SessionLengthWebInDays": 30,
        "SessionLengthMobileInDays": 30,
        "SessionLengthSSOInDays": 30,
        "SessionCacheInMinutes": 10,
        "WebsocketSecurePort": 443,
        "WebsocketPort": 80,
        "WebserverMode": "regular"
    "TeamSettings": {
        "SiteName": "Mattermost",
        "MaxUsersPerTeam": 50,
        "EnableTeamCreation": false,
        "EnableUserCreation": true,
        "EnableOpenServer": false,
        "RestrictCreationToDomains": "",
        "RestrictTeamNames": true,
        "EnableCustomBrand": false,
        "CustomBrandText": "",
        "RestrictDirectMessage": "any"
    "SqlSettings": {
        "DriverName": "postgres",
        "DataSource": "postgres://mattermost:psql_password@",
        "DataSourceReplicas": [],
        "MaxIdleConns": 10,
        "MaxOpenConns": 10,
        "Trace": false,
        "AtRestEncryptKey": encrypt_key
    "LogSettings": {
        "EnableConsole": false,
        "ConsoleLevel": "WARNING",
        "EnableFile": true,
        "FileLevel": "WARNING",
        "FileFormat": "",
        "FileLocation": "/var/log/mattermost/mattermost.log"
    "FileSettings": {
        "DriverName": "local",
        "Directory": "/var/lib/mattermost/",
        "EnablePublicLink": true,
        "PublicLinkSalt": Public_link,
        "ThumbnailWidth": 120,
        "ThumbnailHeight": 100,
        "PreviewWidth": 1024,
        "PreviewHeight": 0,
        "ProfileWidth": 128,
        "ProfileHeight": 128,
        "InitialFont": "luximbi.ttf",
        "AmazonS3AccessKeyId": "",
        "AmazonS3SecretAccessKey": "",
        "AmazonS3Bucket": "",
        "AmazonS3Region": "",
        "AmazonS3Endpoint": "",
        "AmazonS3BucketEndpoint": "",
        "AmazonS3LocationConstraint": false,
        "AmazonS3LowercaseBucket": false
    "EmailSettings": {
        "EnableSignUpWithEmail": true,
        "EnableSignInWithEmail": true,
        "EnableSignInWithUsername": true,
        "SendEmailNotifications": true,
        "RequireEmailVerification": true,
        "FeedbackName": Feedback_user,
        "FeedbackEmail": feedback_email,
        "SMTPUsername": feedback_user,
        "SMTPPassword": password,
        "SMTPServer": mailserver,
        "SMTPPort": "465",
        "ConnectionSecurity": "TLS",
        "InviteSalt": invite salt,
        "PasswordResetSalt": password,
        "SendPushNotifications": false,
        "PushNotificationServer": "",
        "PushNotificationContents": "generic"
    "RateLimitSettings": {
        "EnableRateLimiter": true,
        "PerSec": 10,
        "MemoryStoreSize": 10000,
        "VaryByRemoteAddr": true,
        "VaryByHeader": "X-Real-IP"
    "PrivacySettings": {
        "ShowEmailAddress": true,
        "ShowFullName": true
    "GitLabSettings": {
        "Enable": false,
        "Secret": "",
        "Id": "",
        "Scope": "",
        "AuthEndpoint": "",
        "TokenEndpoint": "",
        "UserApiEndpoint": ""

Version: 3.0.0 (3.0.3)
But we suffer this issue since old version (2.1.0)

$ lsb_release -d; uname -r; free -m
Description:    Ubuntu 14.04.4 LTS
             total       used       free     shared    buffers     cached
Mem:           490        478         12         29         20        173
-/+ buffers/cache:        283        206
Swap:            0          0          0

Expected behavior

memory is stable

Observed behavior

platform consumes more and more memory until it’s killed by kernel (OOM)

Does anybody is experiencing the same issue ? Is this a know issue or just because I wrongly config mattermost?

Thanks & best regards.

Hi @swdream,

Thanks for the report! We recently fixed some resource leaks that will be included in our upcoming 3.2 release, hopefully that should fix the issue.

That said, I’ve created a ticket here to investigate to make sure we’re not leaking in other places.

hi @jwilander,
thanks for your response.

hi @jwilander
could you please tell me something about this issue? it has not updated yet.

Hi @swdream,

We received a community report of a possible leak that we’ll be looking into shortly. The ticket for that one is here. I’ll also link it back to the one you posted as well.