View Issue Details

IDProjectCategoryView StatusLast Update
0004305Composrcorepublic2020-07-02 23:55
ReporterAdam EdingtonAssigned ToChris Graham 
SeverityMajor-bug 
Status resolvedResolutionfixed 
Product Version10.0.31 
Fixed in Version10.0.32 
Summary0004305: Out of memory errors in admin areas
DescriptionNew install on a familiar host and when trying to edit, or doing anything cms/admin related I am plagued with this error.

PHP ERROR [1] Out of memory (allocated 39845888) (tried to allocate 253952 bytes) in sources/tempcode.php on line 142
TagsNo tags attached.
Time estimation (hours)
Sponsorship open

Activities

Guest

2020-06-29 18:56

viewer   ~0006622

From PHP info are you able to tell me what PHP extensions are installed?

Just a full copy and paste with any manual sensoring you want to do would help most.

My guess is this host may have a higher base memory usage due to a large number of PHP extensions, plus more memory due to being 64 bit.

In any case I can try and replicate a similar environment and do testing.

Adam Edington

2020-06-29 20:00

administrator   ~0006623

Array
(
    [0] => Core
    [1] => date
    [2] => libxml
    [3] => openssl
    [4] => pcre
    [5] => zlib
    [6] => filter
    [7] => hash
    [8] => pcntl
    [9] => readline
    [10] => Reflection
    [11] => SPL
    [12] => session
    [13] => standard
    [14] => cgi-fcgi
    [15] => bcmath
    [16] => bz2
    [17] => calendar
    [18] => ctype
    [19] => curl
    [20] => dba
    [21] => dom
    [22] => enchant
    [23] => mbstring
    [24] => fileinfo
    [25] => ftp
    [26] => gd
    [27] => gettext
    [28] => gmp
    [29] => iconv
    [30] => imap
    [31] => intl
    [32] => json
    [33] => ldap
    [34] => exif
    [35] => mysqlnd
    [36] => odbc
    [37] => PDO
    [38] => pgsql
    [39] => Phar
    [40] => posix
    [41] => pspell
    [42] => recode
    [43] => shmop
    [44] => SimpleXML
    [45] => soap
    [46] => sockets
    [47] => sqlite3
    [48] => sysvmsg
    [49] => sysvsem
    [50] => sysvshm
    [51] => tidy
    [52] => tokenizer
    [53] => xml
    [54] => xmlwriter
    [55] => xsl
    [56] => zip
    [57] => mysqli
    [58] => pdo_dblib
    [59] => pdo_mysql
    [60] => PDO_ODBC
    [61] => pdo_pgsql
    [62] => pdo_sqlite
    [63] => wddx
    [64] => xmlreader
    [65] => xmlrpc
    [66] => ionCube Loader
    [67] => Zend OPcache
)

Adam Edington

2020-06-29 20:16

administrator   ~0006624

cat /proc/meminfo:

MemTotal: 32891396 kB
MemFree: 2091064 kB
Buffers: 1076900 kB
Cached: 20911612 kB
SwapCached: 31220 kB
Active: 15167404 kB
Inactive: 7314512 kB
Active(anon): 489212 kB
Inactive(anon): 326900 kB
Active(file): 14678192 kB
Inactive(file): 6987612 kB
Unevictable: 12940 kB
Mlocked: 0 kB
SwapTotal: 4194300 kB
SwapFree: 4108776 kB
Dirty: 2644 kB
Writeback: 0 kB
AnonPages: 391548 kB
Mapped: 50612 kB
Shmem: 319456 kB
Slab: 7990972 kB
SReclaimable: 7586628 kB
SUnreclaim: 404344 kB
KernelStack: 8624 kB
PageTables: 31416 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 20639996 kB
Committed_AS: 4303208 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 663860 kB
VmallocChunk: 34340876504 kB
HardwareCorrupted: 0 kB
AnonHugePages: 45056 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 54272 kB
DirectMap2M: 1972224 kB
DirectMap1G: 31457280 kB

Adam Edington

2020-06-29 20:21

administrator  

Screenshot_2020-06-29 PHP-Info Server Checks.png (359,327 bytes)

Guest

2020-06-29 20:37

viewer   ~0006626

What's this command say?

php -r 'echo memory_get_usage();';

Adam Edington

2020-06-29 20:44

administrator   ~0006627

394184

Adam Edington

2020-07-02 17:54

administrator   ~0006630

Mentioned this to my hosting company today but no response yet. I also just purchased better hosting so hopefully that will help avoid this kind of thing. I've got loads of bespoke CDN options on this new account which look exciting but may conflict with Composr, so that will be fun to experiment with :D Hopefully I can get v11 on there, white screened on my previous account after installing :)

Chris Graham

2020-07-02 23:47

administrator   ~0006635

Ok, so I've got a fix for this coming, but first I will explain the situation. This took me some time to properly dig into.

Composr defines a bare minimum memory of 32M for PHP's memory_limit setting. It recommends 64M and actively tries to set 64M at startup.
This host seems to be imposing a limit of 40M that cannot be overridden. It 'should' work, because Composr with all non-bundled extensions works on 32M on my dev machine, but the large number of PHP extensions on your server may be causing additional memory use, or there may be other factors.

I have made some optimisations and have it working on 26M on my machine now. The main one is a cheat, if Composr detects a low memory limit then it will no longer render the admin menus so deep. That uses a relatively large amount of memory as it has to dig into all the module files to spider out the menu.

I do want to note that since 2006 PHP has had a default memory limit of 128M (https://github.com/php/php-src/commit/3ffc1c8f4a1e4c1658f94038e009e226258a65a4). a 40M limit that you cannot override is painful to see, assuming you didn't have some kind of control panel option to change that.

Note that memory limits may produce inconsistent problems, as the cache state of Composr is going to vary a lot as you go. Generally speaking, if Composr has cached stuff already then it will use less memory.

admin

2020-07-02 23:55

administrator   ~0006636

Automated response: Memory optimisation

Make a number of improvements to Composr's memory debugging ability, and optimisations to support servers with lower memory limits.

admin

2020-07-02 23:55

administrator   ~0006637

Fixed in git commit 423fa2b96 (https://gitlab.com/composr-foundation/composr/commit/423fa2b96 - link will become active once code pushed to GitLab)

A hotfix (a TAR of files to upload) has been uploaded to this issue. These files are made to the latest intra-version state (i.e. may roll in earlier fixes too if made to the same files) - so only upload files newer than what you have already. If there are files in a hot-fix that you don't have then they probably relate to addons that you don't have installed and should be skipped. Always take backups of files you are replacing or keep a copy of the manual installer for your version, and only apply fixes you need. These hotfixes are not necessarily reliable or well supported. Not sure how to extract TAR files to your Windows computer? Try 7-zip (http://www.7-zip.org/).

hotfix-4305, 2020-07-02 11pm.tar (538,624 bytes)

Issue History

Date Modified Username Field Change
2020-06-29 17:58 Adam Edington New Issue
2020-06-29 18:56 Guest Note Added: 0006622
2020-06-29 20:00 Adam Edington Note Added: 0006623
2020-06-29 20:16 Adam Edington Note Added: 0006624
2020-06-29 20:21 Adam Edington File Added: Screenshot_2020-06-29 PHP-Info Server Checks.png
2020-06-29 20:37 Guest Note Added: 0006626
2020-06-29 20:44 Adam Edington Note Added: 0006627
2020-07-02 17:54 Adam Edington Note Added: 0006630
2020-07-02 23:47 Chris Graham Note Added: 0006635