owncloud / core

:cloud: ownCloud web server core (Files, DAV, etc.)
https://owncloud.com
GNU Affero General Public License v3.0
8.36k stars 2.06k forks source link

«mmap() failed: [12] Cannot allocate memory» message in cron.php output #33897

Closed Linda-chan closed 5 years ago

Linda-chan commented 5 years ago

Two weeks ago I've received message like this in cron.php's output:

mmap() failed: [12] Cannot allocate memory

Sometimes it gives me more specific info:

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 398991360) (tried to allocate 20480 bytes) in /var/www/owncloud/apps/files_trashbin/lib/Helper.php on line 92

The files, lines and sizes in message may vary.

This installation of ownCloud was set up month or few ago. Previous was OC 9.x on Ubuntu 14 preconfigured by DigitalOcean and I seen no errors like this. Now I get these errors few times a day.

My current server have 1Gb of RAM and 25Gb of disk space.

It may be coincidence but earlier I've run into bug with thumbnails for deleted files and file versions.

Server configuration

Operating system: 18.04.1 LTS (GNU/Linux 4.15.0-42-generic x86_64)

Web server: Apache/2.4.29 (Ubuntu)

Database: MariaDB 10.1.34

PHP version: PHP 7.2.1

ownCloud version: (see ownCloud admin page) 10.0.10.4 (Community)

Updated from an older ownCloud or fresh install: Fresh install on fresh machine

Where did you install ownCloud from: Tarball

Signing status (ownCloud 9.0 and above): «No errors have been found.»

The content of config/config.php:

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "localhost",
            "port": 6379
        },
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "minimum.supported.desktop.version": "2.0.0",
        "instanceid": "ochfy4320ivs",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***\/owncloud",
        "dbtype": "mysql",
        "version": "10.0.10.4",
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "Etc\/GMT-3",
        "log_type": "owncloud",
        "logfile": "\/var\/log\/owncloud.log",
        "loglevel": 2,
        "installed": true,
        "maintenance": false,
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "log_rotate_size": false
    }
}

List of activated apps:

Enabled:
  - activity: 2.4.1
  - configreport: 0.1.1
  - dav: 0.4.0
  - federatedfilesharing: 0.3.1
  - files: 1.5.1
  - files_external: 0.7.1
  - files_opds: 0.8.8
  - files_pdfviewer: 0.10.0
  - files_sharing: 0.11.0
  - files_texteditor: 2.3.0
  - files_trashbin: 0.9.1
  - files_versions: 1.3.0
  - gallery: 16.1.1
  - market: 0.2.5
  - notifications: 0.3.5
  - updatenotification: 0.2.1
Disabled:
  - announcementcenter
  - comments
  - encryption
  - external
  - federation
  - files_videoplayer
  - firstrunwizard
  - provisioning_api
  - systemtags
  - user_external

Are you using external storage, if yes which one: No

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

ownclouders commented 5 years ago

GitMate.io thinks the contributor most likely able to help you is @ownclouders.

Possibly related issues are https://github.com/owncloud/core/issues/24156 (cron.php fails with error ), https://github.com/owncloud/core/issues/5198 ([5.0.12 cron.php] Create comprehensible error messages), https://github.com/owncloud/core/issues/14296 (OC8 cron.php failing - createFile() on a non-object - Lucene LockManager), https://github.com/owncloud/core/issues/2116 (Cron Service Fails), and https://github.com/owncloud/core/issues/15996 (php occ l10n:createjs fails with error message).

Linda-chan commented 5 years ago

@ho4ho OC9 works fine on 512Mb. And I don't think it's a bug, just thought I misconfigured something and somebody ran into same issue.

http://techpp.com/2009/07/10/how-to-fix-php-fatal-error-out-of-memory/

There is no memory limit on my installation.

Linda-chan commented 5 years ago

I mean my php.ini have line like this:

memory_limit = -1
Linda-chan commented 5 years ago

Today I tweaked apache2.conf with this section:

<IfModule mpm_prefork_module>
        StartServers            3
        MinSpareServers         3
        MaxSpareServers         5
        MaxClients              15
        MaxRequestsPerChild     0
</IfModule>

Not it spawns five processes instead of ten. And I received only one error message since then.

Linda-chan commented 5 years ago

// Actually it was not a question.

Linda-chan commented 5 years ago

Issue.

Linda-chan commented 5 years ago

Alright. Thanks.

usmanjutt84 commented 5 years ago

In my case, updated memory_limit as memory_limit = 2048M in php.ini works for me.